/* ============================================
   OptimizePNG - Modern Stylesheet
   Red theme, dark mode, Lucide icons
   ============================================ */

/* ============================================
   CSS VARIABLES - LIGHT MODE (DEFAULT)
   ============================================ */
:root {
    --transition-speed: 0.25s;

    /* Primary Colors - Red Theme */
    --primary: #e64e4e;
    --primary-light: #fef2f2;
    --primary-dark: #c0392b;
    --primary-rgb: 230, 78, 78;
    --accent: #f87171;

    /* Brand Colors */
    --color-1: #e64e4e;
    --color-2: #3399cc;
    --color-3: #339966;

    /* Background Colors */
    --body-bg: #faf5f5;
    --header-bg: #ffffff;
    --card-bg: #ffffff;
    --card-secondary: #f8f9fa;
    --bg-elevated: #ffffff;

    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    /* Border Colors */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    /* Link Colors */
    --link-color: #e64e4e;
    --link-hover: #c0392b;

    /* Status Colors */
    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --error: #ef4444;
    --error-bg: #fee2e2;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 24px rgba(0,0,0,0.1);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Dropzone */
    --dropzone-bg: #fff8f8;
    --dropzone-border: #e64e4e;
    --dropzone-hover-bg: #fef2f2;

    /* Input */
    --input-bg: #ffffff;
    --input-border: #e2e8f0;

    /* Footer */
    --footer-bg: #1e293b;
    --footer-text: #e2e8f0;
}

/* ============================================
   CSS VARIABLES - DARK MODE
   ============================================ */
[data-theme="dark"] {
    --primary: #f87171;
    --primary-light: rgba(248, 113, 113, 0.12);
    --primary-dark: #ef4444;
    --primary-rgb: 248, 113, 113;
    --accent: #fca5a5;

    --color-1: #f87171;
    --color-2: #60a5fa;
    --color-3: #4ade80;

    --body-bg: #0f172a;
    --header-bg: #1e293b;
    --card-bg: #1e293b;
    --card-secondary: #334155;
    --bg-elevated: #1e293b;

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-light: #64748b;

    --border-color: rgba(255,255,255,0.1);
    --border-light: rgba(255,255,255,0.05);

    --link-color: #f87171;
    --link-hover: #fca5a5;

    --success: #4ade80;
    --success-bg: rgba(74, 222, 128, 0.15);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.15);
    --error: #f87171;
    --error-bg: rgba(248, 113, 113, 0.15);

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 24px rgba(0,0,0,0.4);

    --dropzone-bg: rgba(248, 113, 113, 0.05);
    --dropzone-border: #f87171;
    --dropzone-hover-bg: rgba(248, 113, 113, 0.1);

    --input-bg: #334155;
    --input-border: #475569;

    --footer-bg: #0b1120;
    --footer-text: #cbd5e1;
}

/* ============================================
   BASE STYLES
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    background-color: var(--body-bg);
    color: var(--text-primary);
    transition: background-color var(--transition-speed), color var(--transition-speed);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* ============================================
   LAYOUT
   ============================================ */
.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

.main {
    flex: 1;
    padding: 30px 0 60px;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.header__container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
}

.header__brand:hover {
    text-decoration: none;
    color: var(--text-primary);
}

.brand__icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.brand__icon i {
    width: 20px;
    height: 20px;
}

.brand__text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.brand__text strong {
    color: var(--primary);
}

.header__actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header__link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.header__link:hover {
    color: var(--primary);
    background: var(--primary-light);
    text-decoration: none;
}

.header__link i {
    width: 14px;
    height: 14px;
}

/* ============================================
   THEME TOGGLE - Pill Shape
   ============================================ */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.theme-toggle__track {
    position: relative;
    width: 48px;
    height: 26px;
    background: #334155;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
    transition: background 0.3s ease;
}

[data-theme="dark"] .theme-toggle__track {
    background: #475569;
}

.theme-toggle__icon {
    width: 14px;
    height: 14px;
    color: rgba(255,255,255,0.5);
    position: relative;
    z-index: 1;
}

.theme-toggle__icon--light {
    color: #fbbf24;
}

.theme-toggle__icon--dark {
    color: rgba(255,255,255,0.4);
}

[data-theme="dark"] .theme-toggle__icon--light {
    color: rgba(255,255,255,0.4);
}

[data-theme="dark"] .theme-toggle__icon--dark {
    color: #93c5fd;
}

.theme-toggle__knob {
    position: absolute;
    left: 3px;
    top: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

[data-theme="dark"] .theme-toggle__knob {
    transform: translateX(22px);
}

.theme-toggle__label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    min-width: 36px;
}

@media (max-width: 992px) {
    .theme-toggle__label {
        display: none;
    }
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
    text-align: center;
    margin-bottom: 30px;
}

.hero__title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.hero__icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.hero__subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   DROPZONE
   ============================================ */
.upload-section {
    margin-bottom: 40px;
}

.dropzone {
    position: relative;
    background: var(--dropzone-bg);
    border: 2px dashed var(--dropzone-border);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.dropzone:hover {
    background: var(--dropzone-hover-bg);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1);
}

.dropzone.dragover {
    background: var(--dropzone-hover-bg);
    border-color: var(--primary);
    box-shadow: 0 0 0 6px rgba(var(--primary-rgb), 0.15);
    transform: scale(1.01);
}

.dropzone__idle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.dropzone__icon {
    width: 56px;
    height: 56px;
    color: var(--primary);
    margin-bottom: 4px;
}

.dropzone__icon i {
    width: 56px;
    height: 56px;
}

.dropzone__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.dropzone__text {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.dropzone__limits {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
}

.dropzone__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropzone__btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.dropzone__btn i {
    width: 16px;
    height: 16px;
}

.dropzone__hover {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--primary);
}

.dropzone.dragover .dropzone__idle {
    display: none;
}

.dropzone.dragover .dropzone__hover {
    display: flex;
}

.dropzone__hover-icon {
    width: 48px;
    height: 48px;
    animation: bounce 0.8s infinite;
}

.dropzone__hover-icon i {
    width: 48px;
    height: 48px;
}

.dropzone__hover p {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ============================================
   RESULTS
   ============================================ */
.results {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all var(--transition-speed);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-card__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.result-card__icon--uploading {
    background: var(--primary-light);
    color: var(--primary);
}

.result-card__icon--success {
    background: var(--success-bg);
    color: var(--success);
}

.result-card__icon--error {
    background: var(--error-bg);
    color: var(--error);
}

.result-card__icon i {
    width: 20px;
    height: 20px;
}

.result-card__info {
    flex: 1;
    min-width: 0;
}

.result-card__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-card__meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.result-card__savings {
    font-weight: 700;
    color: var(--success);
}

.result-card__savings--none {
    color: var(--text-muted);
}

.result-card__error-text {
    font-size: 0.8rem;
    color: var(--error);
}

/* Progress Bar */
.result-card__progress {
    width: 100%;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.result-card__progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

.result-card__progress-bar--done {
    background: var(--success);
}

/* Status text */
.result-card__status {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Download Button */
.result-card__actions {
    flex-shrink: 0;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-download:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    text-decoration: none;
    color: #fff;
}

.btn-download i {
    width: 14px;
    height: 14px;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.btn-remove:hover {
    color: var(--error);
    background: var(--error-bg);
}

.btn-remove i {
    width: 16px;
    height: 16px;
}

/* ============================================
   BATCH ACTIONS
   ============================================ */
.batch-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn i {
    width: 16px;
    height: 16px;
}

.btn--primary {
    background: var(--primary);
    color: #fff;
}

.btn--primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn--secondary {
    background: var(--card-secondary);
    color: var(--text-secondary);
}

.btn--secondary:hover {
    background: var(--border-color);
}

/* ============================================
   TOOL DESCRIPTION
   ============================================ */
.tool-description {
    max-width: 800px;
    margin: 0 auto 40px;
}

.tool-description h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 28px 0 12px;
}

.tool-description h2:first-child {
    margin-top: 0;
}

.tool-description h2 i {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.tool-description p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 10px;
}

.tool-description a {
    color: var(--link-color);
    font-weight: 500;
}

.tool-description a:hover {
    color: var(--link-hover);
}

/* Steps List */
.steps-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: step;
}

.steps-list li {
    position: relative;
    padding: 10px 0 10px 40px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    counter-increment: step;
}

.steps-list li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 10px;
    width: 26px;
    height: 26px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ============================================
   FAQ SECTION
   ============================================ */
.faq-section {
    max-width: 800px;
    margin: 0 auto;
}

.faq-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.faq-title i {
    width: 22px;
    height: 22px;
    color: var(--primary);
}

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

.faq-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color 0.2s ease;
    background: var(--card-bg);
}

.faq-item.open {
    border-color: var(--primary);
}

.faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: left;
    transition: color 0.2s ease;
}

.faq-question:hover {
    color: var(--primary);
}

.faq-chevron {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.faq-item.open .faq-chevron {
    transform: rotate(180deg);
    color: var(--primary);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.open .faq-answer {
    max-height: 300px;
}

.faq-answer p {
    padding: 0 18px 14px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 0;
    margin-top: auto;
}

.footer__container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 30px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-wrap: wrap;
    gap: 20px;
}

.footer__brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer__logo {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.footer__logo i {
    width: 22px;
    height: 22px;
}

.footer__brand strong {
    font-size: 1rem;
    color: #fff;
}

.footer__brand p {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0;
}

.footer__links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.footer__links a {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer__links a:hover {
    color: #fff;
    text-decoration: none;
}

.footer__links a i {
    width: 14px;
    height: 14px;
}

.footer__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    flex-wrap: wrap;
    gap: 12px;
}

.footer__bottom p {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0;
}

.footer__bottom a {
    color: #94a3b8;
}

.footer__bottom a:hover {
    color: #fff;
    text-decoration: none;
}

.footer__legal {
    display: flex;
    gap: 16px;
}

.footer__legal a {
    font-size: 0.8rem;
    color: #64748b;
}

.footer__legal a:hover {
    color: #fff;
    text-decoration: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .hero__title {
        font-size: 1.5rem;
    }

    .hero__subtitle {
        font-size: 0.95rem;
    }

    .dropzone {
        padding: 2rem 1.5rem;
    }

    .dropzone__title {
        font-size: 1.1rem;
    }

    .result-card {
        flex-wrap: wrap;
        padding: 14px 16px;
    }

    .result-card__info {
        min-width: calc(100% - 54px);
    }

    .result-card__actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        margin-top: 4px;
    }

    .batch-actions {
        flex-direction: column;
    }

    .batch-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .footer__top {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer__bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    .header__link span {
        display: none;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 14px;
    }

    .hero__title {
        font-size: 1.3rem;
    }

    .dropzone {
        padding: 1.5rem 1rem;
    }

    .footer__links {
        flex-direction: column;
        gap: 10px;
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--body-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   SELECTION
   ============================================ */
::selection {
    background: rgba(var(--primary-rgb), 0.2);
    color: var(--text-primary);
}
