/* ═══════════════════════════════════════════════════
   WisdomPress — Image Compressor
   Premium Dark UI with Glassmorphism
   ═══════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────── */
:root {
    --bg:           #0b0d14;
    --bg2:          #111521;
    --bg3:          #181d2e;
    --surface:      rgba(255,255,255,0.04);
    --surface-hover:rgba(255,255,255,0.07);
    --border:       rgba(255,255,255,0.08);
    --border-bright:rgba(255,255,255,0.14);

    --accent:       #6c63ff;
    --accent2:      #a78bfa;
    --accent-glow:  rgba(108,99,255,0.35);
    --green:        #22d3a0;
    --green-dim:    rgba(34,211,160,0.12);
    --red:          #f87171;
    --yellow:       #fbbf24;

    --text:         #e8eaf6;
    --text-muted:   #8b93b5;
    --text-dim:     #535878;

    --radius-sm:    8px;
    --radius:       14px;
    --radius-lg:    20px;
    --radius-xl:    28px;

    --shadow-sm:    0 2px 12px rgba(0,0,0,0.4);
    --shadow:       0 8px 32px rgba(0,0,0,0.5);
    --shadow-glow:  0 0 30px var(--accent-glow);

    --transition:   0.22s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ─────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2a2f4a; border-radius: 3px; }

/* ══════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px) saturate(180%);
    background: rgba(11,13,20,0.85);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
}
.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}
.brand-icon {
    font-size: 24px;
    filter: drop-shadow(0 0 8px var(--accent));
}
.brand-name {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 30%, var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.brand-tag {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 2px 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Brand home link ───────────────────────────────── */
.brand-home-link {
    text-decoration: none;
    font-size: 22px;
    filter: drop-shadow(0 0 8px var(--accent));
    transition: var(--transition);
    line-height: 1;
}
.brand-home-link:hover { filter: drop-shadow(0 0 14px var(--accent2)); transform: scale(1.1); }

/* ── Tool nav ──────────────────────────────────────── */
.tool-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
}
.tool-nav-link {
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 50px;
    border: 1px solid transparent;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
}
.tool-nav-link:hover {
    color: var(--text);
    background: var(--surface);
    border-color: var(--border);
}
.tool-nav-link.active {
    color: var(--accent2);
    background: rgba(108,99,255,0.12);
    border-color: rgba(108,99,255,0.3);
}

/* ══════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    text-decoration: none;
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: #fff;
    box-shadow: 0 4px 20px rgba(108,99,255,0.4);
}
.btn-primary:hover {
    box-shadow: 0 6px 28px rgba(108,99,255,0.6);
    filter: brightness(1.1);
}

.btn-ghost {
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    background: var(--surface-hover);
    color: var(--text);
    border-color: var(--border-bright);
}

.btn-outline {
    background: transparent;
    color: var(--accent2);
    border: 1px solid var(--accent);
}
.btn-outline:hover {
    background: rgba(108,99,255,0.12);
    box-shadow: 0 0 20px rgba(108,99,255,0.25);
}

.btn-green {
    background: linear-gradient(135deg, #059669, var(--green));
    color: #fff;
    box-shadow: 0 4px 20px rgba(34,211,160,0.3);
}
.btn-green:hover {
    box-shadow: 0 6px 28px rgba(34,211,160,0.5);
    filter: brightness(1.1);
}

.btn-sm { padding: 6px 14px; font-size: 13px; }

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ══════════════════════════════════════════════════
   SETTINGS BAR
══════════════════════════════════════════════════ */
.settings-bar {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    position: sticky;
    top: 64px;
    z-index: 90;
    backdrop-filter: blur(10px);
}
.settings-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.setting-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
.setting-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    white-space: nowrap;
}
.slider-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
input[type="range"] {
    -webkit-appearance: none;
    width: 130px;
    height: 4px;
    background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--pct, 75%), #2a2f4a var(--pct, 75%));
    border-radius: 2px;
    cursor: pointer;
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    cursor: pointer;
    transition: var(--transition);
}
input[type="range"]::-webkit-slider-thumb:hover {
    box-shadow: 0 0 14px var(--accent);
}
.slider-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent2);
    min-width: 28px;
    text-align: center;
}
select, input[type="number"] {
    background: var(--bg3);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}
select:focus, input[type="number"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108,99,255,0.18);
}
input[type="number"] { width: 90px; }

/* ══════════════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════════════ */
.main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 24px 80px;
}

/* ══════════════════════════════════════════════════
   DROP ZONE
══════════════════════════════════════════════════ */
.drop-zone-section {
    display: flex;
    justify-content: center;
    padding: 40px 0 60px;
}
.drop-zone {
    width: 100%;
    max-width: 700px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-xl);
    padding: 64px 40px;
    text-align: center;
    background: var(--bg2);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(108,99,255,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.drop-zone.dragover {
    border-color: var(--accent);
    background: rgba(108,99,255,0.06);
    box-shadow: 0 0 40px var(--accent-glow);
    transform: scale(1.01);
}
.dz-icon {
    font-size: 64px;
    margin-bottom: 16px;
    display: block;
    filter: drop-shadow(0 0 16px rgba(108,99,255,0.4));
    animation: float 3s ease-in-out infinite;
}
@keyframes float {
    0%,100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.dz-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff 30%, var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.dz-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 28px;
}
.dz-btn {
    font-size: 15px;
    padding: 12px 32px;
    cursor: pointer;
}

/* ══════════════════════════════════════════════════
   SUMMARY BAR
══════════════════════════════════════════════════ */
.summary-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 20px;
}
.summary-stat {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}
.summary-stat.highlight {
    color: var(--green);
    font-weight: 700;
    font-size: 15px;
}
.summary-bar .btn-sm { margin-left: auto; }

/* ══════════════════════════════════════════════════
   IMAGE GRID
══════════════════════════════════════════════════ */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

/* ── Card ──────────────────────────────────────── */
.img-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    animation: cardIn 0.35s ease both;
    position: relative;
}
@keyframes cardIn {
    from { opacity:0; transform: translateY(20px) scale(0.97); }
    to   { opacity:1; transform: none; }
}
.img-card:hover {
    border-color: var(--border-bright);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

/* Thumbnail */
.card-thumb {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    background: var(--bg3);
    cursor: zoom-in;
    transition: filter 0.3s;
}
.img-card:hover .card-thumb { filter: brightness(1.05); }

/* State badge */
.card-status {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.status-pending  { background: rgba(251,191,36,0.15); color: var(--yellow); border: 1px solid rgba(251,191,36,0.3); }
.status-loading  { background: rgba(108,99,255,0.15); color: var(--accent2); border: 1px solid rgba(108,99,255,0.3); }
.status-done     { background: rgba(34,211,160,0.12); color: var(--green);  border: 1px solid rgba(34,211,160,0.3); }
.status-error    { background: rgba(248,113,113,0.12); color: var(--red);   border: 1px solid rgba(248,113,113,0.3); }

/* Card body */
.card-body {
    padding: 14px 16px 16px;
}
.card-filename {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 10px;
}

/* Stats row */
.card-stats {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

/* Tip panel — shown when image can't be made smaller at current settings */
.card-tip {
    background: rgba(251,191,36,0.06);
    border: 1px solid rgba(251,191,36,0.2);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 10px;
}
/* Variant for successfully-compressed images (purple instead of amber) */
.card-tip--success {
    background: rgba(108,99,255,0.06);
    border-color: rgba(108,99,255,0.2);
}
.card-tip--success .tip-heading {
    color: var(--accent2);
}
.card-tip--success .tip-btn {
    background: rgba(108,99,255,0.1);
    border-color: rgba(108,99,255,0.25);
    color: var(--accent2);
}
.card-tip--success .tip-btn:hover {
    background: rgba(108,99,255,0.2);
    border-color: rgba(108,99,255,0.5);
    box-shadow: 0 3px 10px rgba(108,99,255,0.2);
}
.card-tip--success .tip-dim {
    color: rgba(167,139,250,0.6);
}
.tip-heading {
    font-size: 11px;
    font-weight: 600;
    color: #f0b429;
    margin-bottom: 8px;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.tip-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tip-group {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.tip-group-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    min-width: 62px;
}
.tip-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    background: rgba(251,191,36,0.1);
    border: 1px solid rgba(251,191,36,0.25);
    color: #f0b429;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.2;
}
.tip-btn:hover {
    background: rgba(251,191,36,0.2);
    border-color: rgba(251,191,36,0.5);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(251,191,36,0.2);
}
.tip-btn:active { transform: scale(0.95); }
.tip-dim {
    font-size: 9px;
    font-weight: 500;
    color: rgba(240,180,41,0.65);
    display: block;
}
.stat-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 50px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: var(--bg3);
}
.stat-pill.green {
    color: var(--green);
    border-color: rgba(34,211,160,0.3);
    background: var(--green-dim);
}
.stat-pill.purple {
    color: var(--accent2);
    border-color: rgba(167,139,250,0.3);
    background: rgba(108,99,255,0.1);
}

/* Progress bar */
.card-progress {
    height: 3px;
    background: var(--bg3);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
}
.card-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-radius: 2px;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
    width: 0;
}

/* Card actions */
.card-actions {
    display: flex;
    gap: 6px;
}
.card-actions .btn {
    flex: 1;
    justify-content: center;
    font-size: 12px;
    padding: 7px 10px;
}

/* ══════════════════════════════════════════════════
   EXPORT PANEL
══════════════════════════════════════════════════ */
.export-panel {
    background: linear-gradient(135deg, rgba(108,99,255,0.1), rgba(34,211,160,0.08));
    border: 1px solid rgba(108,99,255,0.25);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    animation: cardIn 0.4s ease;
}
.export-info {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.export-info span {
    color: var(--green);
}
.export-actions {
    display: flex;
    gap: 10px;
}

/* ══════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5,7,15,0.85);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.25s ease;
}
.modal-overlay.open { display: flex; }

@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.modal-box {
    background: var(--bg2);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04);
    animation: modalIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes modalIn {
    from { transform: scale(0.92) translateY(20px); opacity:0; }
    to   { transform: none; opacity:1; }
}
.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 16px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10;
}
.modal-close:hover {
    background: rgba(248,113,113,0.15);
    color: var(--red);
    border-color: rgba(248,113,113,0.3);
}
.modal-tabs {
    display: flex;
    gap: 4px;
    padding: 16px 20px 0;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
    color: var(--accent2);
    border-bottom-color: var(--accent);
    background: rgba(108,99,255,0.08);
}
.modal-body {
    flex: 1;
    overflow: auto;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 16px;
}
.modal-body img {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.modal-img-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.modal-img-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

/* ══════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}
.toast {
    background: var(--bg2);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    box-shadow: var(--shadow);
    animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
    max-width: 340px;
}
@keyframes toastIn {
    from { transform: translateX(60px); opacity: 0; }
    to   { transform: none; opacity: 1; }
}
.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--red); }
.toast-info    { border-left: 3px solid var(--accent); }
.toast.hiding  { animation: toastOut 0.3s ease forwards; }
@keyframes toastOut {
    to { transform: translateX(60px); opacity: 0; }
}

/* ══════════════════════════════════════════════════
   LOADING SPINNER
══════════════════════════════════════════════════ */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: var(--accent2);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════ */
@media (max-width: 640px) {
    .settings-inner { gap: 14px; }
    .setting-group { flex-wrap: wrap; }
    input[type="range"] { width: 100px; }
    .image-grid { grid-template-columns: 1fr; }
    .export-panel { flex-direction: column; align-items: flex-start; }
    .modal-body { flex-direction: column; }
    .dz-title { font-size: 22px; }
    .drop-zone { padding: 40px 20px; }
}
