/* CSS Variables for Premium Design System */
:root {
    --bg-primary: #0b0f19;
    --bg-secondary: rgba(15, 23, 42, 0.6);
    --bg-card: rgba(20, 30, 54, 0.7);
    --accent: #facc15;
    --accent-hover: #eab308;
    --accent-glow: rgba(250, 204, 21, 0.25);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --border-color: rgba(250, 204, 21, 0.12);
    --border-hover: rgba(250, 204, 21, 0.4);
    
    --success: #10b981;
    --success-hover: #059669;
    --success-glow: rgba(16, 185, 129, 0.2);
    
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 8px;
    
    --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.7), 
                      0 1px 0px 0px rgba(255, 255, 255, 0.05) inset;
    --shadow-accent: 0 10px 25px -5px rgba(250, 204, 21, 0.3);
    
    /* Bouncy Spring Transition (Mlenis/Responsive feel) */
    --spring-transition: all 0.5s cubic-bezier(0.34, 1.75, 0.64, 1);
    --smooth-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Ambient Background Glow */
.app-background-glow {
    position: fixed;
    top: -20%;
    left: -10%;
    width: 60vw;
    height: 60vh;
    background: radial-gradient(circle, rgba(250, 204, 21, 0.06) 0%, rgba(11, 15, 25, 0) 70%);
    z-index: -1;
    pointer-events: none;
    filter: blur(80px);
}

.app-container {
    width: 100%;
    max-width: 1400px;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header Styles */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 1.5rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent) 0%, #ca8a04 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 1.5rem;
    box-shadow: 0 8px 20px -6px var(--accent-hover);
}

.logo-text h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.logo-text h1 span {
    color: var(--accent);
}

.logo-text .subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 700;
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 0 0 var(--accent-glow);
    animation: pulse 1.6s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.7);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 6px rgba(250, 204, 21, 0);
    }
    100% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(250, 204, 21, 0);
    }
}

/* Dashboard Grid Layout (Responsive Controls + Workspace) */
.dashboard-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 2rem;
    align-items: start;
}

/* Premium Card Style */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
    overflow: hidden;
    transition: var(--smooth-transition);
}

.card:hover {
    border-color: rgba(250, 204, 21, 0.22);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-header i {
    color: var(--accent);
    font-size: 1.25rem;
}

.card-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
}

.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Settings Card Styles */
.settings-card {
    padding-bottom: 1.25rem;
}

.setting-group {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.setting-group:last-of-type {
    border-bottom: none;
}

.setting-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.badge-value {
    background: rgba(250, 204, 21, 0.1);
    color: var(--accent);
    border: 1px solid rgba(250, 204, 21, 0.2);
    padding: 0.15rem 0.6rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
}

.setting-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.6rem;
}

/* Custom Range Input (Slider) Styling */
.slider-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
    transition: var(--spring-transition);
    border: 3px solid #0b0f19;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.25);
    background: #fff;
    box-shadow: 0 0 15px var(--accent);
}

/* Custom Radios for Crop Mode */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-label {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.85rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--smooth-transition);
}

.radio-label:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(250, 204, 21, 0.1);
}

.radio-label input[type="radio"] {
    display: none;
}

.custom-radio {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    transition: var(--smooth-transition);
}

.radio-label input[type="radio"]:checked + .custom-radio {
    border-color: var(--accent);
}

.custom-radio::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent);
    transform: scale(0);
    transition: var(--spring-transition);
}

.radio-label input[type="radio"]:checked + .custom-radio::after {
    transform: scale(1);
}

.radio-label input[type="radio"]:checked ~ .radio-text .radio-title {
    color: var(--accent);
}

.radio-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.radio-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    transition: var(--smooth-transition);
}

.radio-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.clipboard-hint {
    margin: 0 1.5rem;
    padding: 0.65rem;
    background: rgba(250, 204, 21, 0.03);
    border: 1px dashed rgba(250, 204, 21, 0.15);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.clipboard-hint i {
    color: var(--accent);
    font-size: 0.85rem;
}

/* Compact Buttons Wrapper in Header */
.action-buttons-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-compact {
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--spring-transition);
}

.btn-compact-add {
    background-color: var(--accent);
    color: #0b0f19;
}

.btn-compact-add:hover {
    transform: translateY(-2px);
    background-color: #fff;
    box-shadow: 0 4px 12px rgba(250, 204, 21, 0.25);
}

.btn-compact-all {
    background-color: var(--success);
    color: #fff;
}

.btn-compact-all:hover {
    transform: translateY(-2px);
    background-color: var(--success-hover);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* Dynamic Horizontal Thumbnails Bar */
.thumbnails-bar {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.85rem 1.5rem;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    align-items: center;
}

/* Custom Scrollbar for Thumbnails Bar */
.thumbnails-bar::-webkit-scrollbar {
    height: 4px;
}
.thumbnails-bar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
.thumbnails-bar::-webkit-scrollbar-thumb {
    background: rgba(250, 204, 21, 0.2);
    border-radius: 2px;
}
.thumbnails-bar::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.thumbnail-item {
    position: relative;
    flex-shrink: 0;
    width: 80px;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    background-color: #000;
    transition: var(--spring-transition);
}

.thumbnail-item:hover {
    transform: translateY(-2px);
    border-color: rgba(250, 204, 21, 0.4);
}

.thumbnail-item.active {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.35);
    transform: scale(1.05);
}

.thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.thumb-size {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.6rem;
    font-weight: 800;
    background: rgba(0, 0, 0, 0.75);
    color: var(--accent);
    padding: 1px 3px;
    border-radius: 3px;
    pointer-events: none;
}

.thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: rgba(239, 68, 68, 0.85);
    border: none;
    color: #fff;
    font-size: 0.55rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--smooth-transition);
    z-index: 10;
}

.thumbnail-item:hover .thumb-remove {
    opacity: 1;
}

.thumb-remove:hover {
    background-color: #ef4444;
    transform: scale(1.15);
}

/* Studio Preview Workspace */
.preview-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.preview-placeholder {
    flex: 1;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    text-align: center;
}

.placeholder-art {
    margin-bottom: 1.5rem;
}

.canvas-mock {
    width: 160px;
    height: 90px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.canvas-mock::before {
    content: '';
    position: absolute;
    width: 60px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 4px;
}

.ratio-text {
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.15);
}

.preview-placeholder h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.preview-placeholder p {
    color: var(--text-muted);
    font-size: 0.85rem;
    max-width: 320px;
}

/* Image Studio Preview / Slider */
.preview-workspace {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
}

.slider-comparison-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-premium);
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: #020617;
}

.slider-comparison-container img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.after-overlay {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 50%;
    overflow: hidden;
    border-right: 2px solid var(--accent);
}

.after-overlay img {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
}

/* Label badges on previews */
.badge-label {
    position: absolute;
    bottom: 12px;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.label-before {
    left: 12px;
    background: rgba(15, 23, 42, 0.8);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.label-after {
    right: 12px;
    background: rgba(250, 204, 21, 0.9);
    color: #000;
    border: 1px solid rgba(250, 204, 21, 0.2);
}

/* Swipe Controller Handle */
.slider-handle {
    position: absolute;
    top: 0;
    left: 50%;
    height: 100%;
    width: 4px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 15;
    pointer-events: none;
}

.handle-line {
    flex: 1;
    width: 2px;
    background-color: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

.handle-button {
    width: 36px;
    height: 36px;
    background-color: var(--accent);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    box-shadow: 0 0 15px rgba(250, 204, 21, 0.6);
    border: 3px solid var(--bg-primary);
}

/* Statistics Layout */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr 1fr;
    gap: 1rem;
    align-items: center;
}

.stat-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.15rem;
    font-weight: 700;
}

.stat-arrow {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.accent-box {
    border-color: rgba(250, 204, 21, 0.15);
}

.saved-box {
    background: rgba(16, 185, 129, 0.04);
    border-color: rgba(16, 185, 129, 0.15);
}

.saved-box .highlight {
    color: var(--success);
}

/* Instant Download Button (Responsive and bouncy "mlenis" feel) */
.action-area {
    margin-top: 0.5rem;
}

.btn {
    width: 100%;
    border: none;
    outline: none;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.1rem 2rem;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    transition: var(--spring-transition);
}

.btn-download {
    background: linear-gradient(135deg, var(--accent) 0%, #eab308 100%);
    color: #0b0f19;
    box-shadow: var(--shadow-accent);
}

.btn-download:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 30px rgba(250, 204, 21, 0.4);
    background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
}

.btn-download:active {
    transform: translateY(-1px) scale(0.99);
    box-shadow: 0 5px 15px rgba(250, 204, 21, 0.3);
}

.btn i {
    font-size: 1.25rem;
}

/* Toast Alerts */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 9999;
}

.toast {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-premium);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: var(--text-main);
    transform: translateY(20px);
    opacity: 0;
    animation: toast-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes toast-in {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.toast.toast-success {
    border-left: 4px solid var(--success);
}

.toast.toast-error {
    border-left: 4px solid #ef4444;
}

.toast i {
    font-size: 1.15rem;
}

.toast.toast-success i {
    color: var(--success);
}

.toast.toast-error i {
    color: #ef4444;
}

/* Footer Section */
.app-footer {
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Media Queries for Responsive Screens */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .app-container {
        padding: 1.5rem 1rem;
    }
    
    .card-header {
        gap: 0.75rem;
    }
}

@media (max-width: 640px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .header-badge {
        align-self: flex-start;
    }
    
    .card-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-buttons-wrapper {
        justify-content: space-between;
        margin-top: 0.5rem;
    }
    
    .btn-compact {
        flex: 1;
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .stat-arrow {
        display: none;
    }
    
    .stats-grid > .stat-box:nth-child(1) {
        grid-column: 1;
    }
    
    .stats-grid > .stat-box:nth-child(3) {
        grid-column: 2;
    }
    
    .stats-grid > .stat-box.saved-box {
        grid-column: span 2;
    }
    
    .btn {
        padding: 0.9rem 1.5rem;
        font-size: 0.95rem;
    }
}
