/* ===== Shadow Generator Styles ===== */

/* ===== Layout ===== */
.shadow-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 30px;
    margin-bottom: 40px;
}

.shadow-result {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.shadow-controls {
    position: sticky;
    top: 100px;
    height: fit-content;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.shadow-controls .control-panel {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(45, 52, 54, 0.08);
}

/* Custom scrollbar for control panel */
.shadow-controls .control-panel::-webkit-scrollbar {
    width: 6px;
}

.shadow-controls .control-panel::-webkit-scrollbar-track {
    background: transparent;
}

.shadow-controls .control-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.shadow-controls .control-panel::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ===== Shadow Type Tabs ===== */
.shadow-tabs {
    display: flex;
    gap: 8px;
    padding: 6px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(45, 52, 54, 0.06);
}

.shadow-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.shadow-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.shadow-tab.active {
    background: var(--accent-secondary);
    color: white;
    box-shadow: 0 2px 8px rgba(78, 205, 196, 0.3);
}

.shadow-tab span {
    font-size: 1.1rem;
}

/* ===== Preview Panel ===== */
.preview-panel {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(45, 52, 54, 0.08);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.panel-title span {
    font-size: 1.1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--accent-secondary);
    transform: scale(1.05);
}

.preview-container {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: 
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
        linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #fafafa;
    border-radius: 12px;
    overflow: hidden;
}

.preview-box-wrapper,
.preview-text-wrapper {
    width: 100%;
    height: 100%;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.preview-box {
    width: 180px;
    height: 180px;
    background: #ffffff;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.preview-text {
    font-size: 48px;
    font-weight: 800;
    color: #2d3436;
    text-align: center;
    transition: all 0.3s ease;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

/* ===== Layers Panel ===== */
.layers-panel {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(45, 52, 54, 0.08);
}

.layers-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.btn-add-layer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-layer:hover {
    background: var(--accent-secondary);
    color: white;
}

.btn-add-layer span {
    font-size: 1rem;
    font-weight: 700;
}

.layers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.layer-item:hover {
    background: var(--bg-hover);
}

.layer-item.active {
    background: rgba(78, 205, 196, 0.1);
    border-color: var(--accent-secondary);
}

.layer-item__preview {
    width: 36px;
    height: 36px;
    background: white;
    border-radius: 6px;
    flex-shrink: 0;
}

.layer-item__info {
    flex: 1;
    min-width: 0;
}

.layer-item__name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.layer-item__values {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-item__actions {
    display: flex;
    gap: 4px;
}

.layer-item__btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.layer-item__btn:hover {
    background: var(--bg-card);
    opacity: 1;
}

.layer-item__btn--delete:hover {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
}

/* ===== Code Panel ===== */
.code-panel {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(45, 52, 54, 0.08);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.btn-copy {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-copy:hover {
    background: var(--accent-secondary);
    color: white;
}

.btn-copy span {
    font-size: 0.95rem;
}

.code-block {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 20px;
    border-radius: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    overflow-x: auto;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ===== Control Panel ===== */
.current-layer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(78, 205, 196, 0.1);
    border-radius: 10px;
    margin-bottom: 20px;
}

.current-layer__badge {
    padding: 4px 10px;
    background: var(--accent-secondary);
    color: white;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
}

.current-layer__hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.control-group {
    margin-bottom: 20px;
}

.control-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.control-label span:first-child {
    font-size: 1rem;
}

.control-value {
    margin-left: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-secondary);
    background: rgba(78, 205, 196, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.control-range {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-secondary);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.control-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-secondary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(78, 205, 196, 0.4);
    transition: transform 0.2s ease;
}

.control-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.control-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-secondary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(78, 205, 196, 0.4);
}

/* Color Input */
.color-input-group {
    display: flex;
    gap: 10px;
}

.color-picker {
    width: 50px;
    height: 42px;
    padding: 4px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    background: var(--bg-secondary);
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-text {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-transform: uppercase;
}

.color-text:focus {
    outline: none;
    border-color: var(--accent-secondary);
}

/* Toggle Item */
.toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.toggle-label span {
    font-size: 1rem;
}

.toggle-item input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--bg-secondary);
    border-radius: 13px;
    transition: all 0.3s ease;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.toggle-item input:checked + .toggle-slider {
    background: var(--accent-secondary);
}

.toggle-item input:checked + .toggle-slider::after {
    left: 25px;
}

/* Control Divider */
.control-divider {
    height: 1px;
    background: var(--border-color);
    margin: 24px 0;
}

/* Control Section */
.control-section {
    margin-bottom: 20px;
}

.control-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.control-section-title span {
    font-size: 1rem;
}

/* Text Input */
.text-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.text-input:focus {
    outline: none;
    border-color: var(--accent-secondary);
}

/* Preset Grid */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 10px;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    border-color: var(--accent-secondary);
    transform: translateY(-2px);
}

.preset-btn__preview {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 8px;
}

.preset-btn__name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

/* ===== Mobile Floating Preview Bar ===== */
.mobile-preview-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: var(--bg-card);
    border-top: 1px solid rgba(45, 52, 54, 0.1);
    box-shadow: 0 -4px 20px rgba(45, 52, 54, 0.15);
    align-items: center;
    gap: 12px;
}

.mobile-preview-bar__box {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 8px;
    flex-shrink: 0;
}

.mobile-preview-bar__info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.mobile-preview-bar__row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-preview-bar__row--secondary {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.mobile-preview-bar__label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-secondary);
}

.mobile-preview-bar__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.mobile-preview-bar__btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.mobile-preview-bar__btn:hover,
.mobile-preview-bar__btn:active {
    background: var(--accent-secondary);
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 14px 24px;
    background: var(--text-primary);
    color: white;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(45, 52, 54, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .shadow-layout {
        grid-template-columns: 1fr;
    }
    
    .shadow-controls {
        position: static;
        max-height: none;
    }
    
    .mobile-preview-bar {
        display: flex;
    }
    
    .main-content {
        padding-bottom: 100px;
    }
    
    .toast {
        bottom: 110px;
    }
    
    .toast.show {
        transform: translateX(-50%) translateY(0);
    }
    
    /* Compact control panel */
    .control-panel {
        padding: 20px;
    }
    
    .control-group {
        margin-bottom: 16px;
    }
    
    .preset-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .preset-btn {
        padding: 10px 8px;
    }
    
    .preset-btn__preview {
        width: 40px;
        height: 40px;
    }
    
    .preset-btn__name {
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) {
    .shadow-tabs {
        flex-direction: row;
    }
    
    .shadow-tab {
        padding: 12px 16px;
        font-size: 0.85rem;
    }
    
    .shadow-tab span {
        font-size: 1rem;
    }
    
    .preview-container {
        min-height: 250px;
    }
    
    .preview-box-wrapper,
    .preview-text-wrapper {
        min-height: 250px;
        padding: 30px;
    }
    
    .preview-box {
        width: 140px;
        height: 140px;
        font-size: 0.8rem;
    }
    
    .preview-text {
        font-size: 36px;
    }
    
    .layer-item {
        padding: 10px 12px;
    }
    
    .layer-item__preview {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .shadow-tabs {
        padding: 4px;
        gap: 4px;
    }
    
    .shadow-tab {
        padding: 10px 12px;
        font-size: 0.8rem;
        gap: 6px;
    }
    
    .preview-container {
        min-height: 200px;
    }
    
    .preview-box-wrapper,
    .preview-text-wrapper {
        min-height: 200px;
        padding: 20px;
    }
    
    .preview-box {
        width: 120px;
        height: 120px;
    }
    
    .preview-text {
        font-size: 28px;
    }
    
    .preset-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .control-range::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.shadow-tabs,
.preview-panel,
.layers-panel,
.code-panel,
.control-panel {
    animation: fadeIn 0.4s ease forwards;
}

.preview-panel { animation-delay: 0.1s; }
.layers-panel { animation-delay: 0.2s; }
.code-panel { animation-delay: 0.3s; }
.control-panel { animation-delay: 0.15s; }
