/* ============================================
   Local Image Compressor — style.css
   Author: gorupa (https://github.com/gorupa)
   License: MIT
   ============================================ */

:root {
    --primary: #1a73e8;
    --primary-hover: #1557b0;
    --primary-light: #e8f0fe;
    --surface: #ffffff;
    --background: #f0f4f9;
    --text-main: #1c1e21;
    --text-muted: #5f6368;
    --border: #dadce0;
    --success: #1e8e3e;
    --success-light: #e6f4ea;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.05);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.1), 0 4px 16px rgba(0,0,0,0.06);
    --radius: 20px;
    --radius-sm: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'DM Sans', sans-serif;
    background-color: var(--background);
    background-image:
        radial-gradient(ellipse 90% 60% at 50% -5%, rgba(26, 115, 232, 0.13) 0%, transparent 65%),
        radial-gradient(ellipse 55% 45% at 92% 95%, rgba(30, 142, 62, 0.08) 0%, transparent 55%),
        radial-gradient(ellipse 40% 40% at 5% 80%, rgba(26, 115, 232, 0.05) 0%, transparent 50%);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 32px 20px;
    gap: 20px;
}

/* ── Animations ── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0 0 rgba(26,115,232,0.25); }
    70%  { box-shadow: 0 0 0 10px rgba(26,115,232,0); }
    100% { box-shadow: 0 0 0 0 rgba(26,115,232,0); }
}
@keyframes pop-in {
    0%   { opacity: 0; transform: scale(0.85); }
    70%  { transform: scale(1.03); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes check-bounce {
    0%   { transform: scale(0) rotate(-10deg); }
    60%  { transform: scale(1.15) rotate(3deg); }
    80%  { transform: scale(0.95); }
    100% { transform: scale(1) rotate(0deg); }
}

/* ── Badge Strip ── */
.badge-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    animation: fadeUp 0.5s ease both;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 13px;
    border-radius: 100px;
    font-size: 0.71rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: default;
    user-select: none;
}
.pill:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.pill .material-icons-round { font-size: 13px; }

.pill-mit    { background: #fff8e1; color: #92400e; border-color: #fde68a; }
.pill-oss    { background: #ede9fe; color: #4c1d95; border-color: #c4b5fd; }
.pill-adfree { background: #ecfdf5; color: #065f46; border-color: #6ee7b7; }
.pill-local  { background: var(--primary-light); color: #1e3a8a; border-color: #bfdbfe; }

/* ── Container ── */
.container {
    max-width: 560px;
    width: 100%;
    animation: fadeUp 0.5s ease 0.08s both;
}

/* ── Header ── */
.header { text-align: center; margin-bottom: 28px; }

.hero-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    background: linear-gradient(135deg, #e8f0fe 0%, #d2e3fc 100%);
    border-radius: 22px;
    margin-bottom: 18px;
    box-shadow: 0 0 0 8px rgba(26, 115, 232, 0.08);
    animation: pulse-ring 3s ease-in-out infinite;
}
.hero-icon { font-size: 34px; color: var(--primary); }

.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.6px;
    margin-bottom: 7px;
    background: linear-gradient(135deg, var(--text-main) 0%, #3c4043 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.header p { color: var(--text-muted); font-size: 0.925rem; line-height: 1.5; }

/* ── Sibling tool link ── */
.tool-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #e8410a;
    text-decoration: none;
    padding: 4px 12px;
    border-radius: 100px;
    background: #fff0eb;
    border: 1px solid #fca99d;
    transition: all 0.15s ease;
}
.tool-link:hover { background: #ffd9cc; transform: translateY(-1px); }
.tool-link .material-icons-round { font-size: 14px; }

/* ── Card ── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 28px;
    border: 1px solid rgba(255,255,255,0.9);
    backdrop-filter: blur(8px);
    transition: box-shadow 0.3s ease;
}
.card:hover { box-shadow: 0 16px 48px rgba(0,0,0,0.12), 0 4px 16px rgba(0,0,0,0.06); }

/* ── Upload Zone ── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 52px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: #fafbfc;
    position: relative;
    overflow: hidden;
}
.upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary-light) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.upload-zone:hover::before, .upload-zone.drag-over::before { opacity: 1; }
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(26,115,232,0.12);
}
.upload-zone .material-icons-round {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 14px;
    display: block;
    position: relative;
    transition: transform 0.3s ease;
}
.upload-zone:hover .material-icons-round { transform: translateY(-4px) scale(1.05); }
.upload-zone h3 { margin-bottom: 6px; font-weight: 600; font-size: 1.05rem; position: relative; }
.upload-zone p  { color: var(--text-muted); font-size: 0.85rem; position: relative; margin-bottom: 14px; }

.format-tags { display: flex; gap: 6px; justify-content: center; position: relative; }
.format-tag {
    background: var(--border);
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.71rem;
    font-weight: 600;
    font-family: 'DM Mono', monospace;
    color: var(--text-muted);
}

/* ── File Info ── */
.controls { margin-top: 4px; }

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--background);
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 22px;
    border: 1px solid var(--border);
    animation: fadeUp 0.3s ease both;
}
.file-info .material-icons-round { color: var(--primary); font-size: 20px; flex-shrink: 0; }
.file-info #originalFileName {
    flex: 1;
    font-weight: 500;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.badge {
    background: var(--border);
    padding: 3px 9px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: 'DM Mono', monospace;
    flex-shrink: 0;
}

/* ── Slider ── */
.slider-container { margin-bottom: 18px; }
.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 0.88rem;
}
.quality-val {
    font-family: 'DM Mono', monospace;
    font-size: 1.05rem;
    color: var(--primary);
    font-weight: 700;
}
.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 6px;
    font-weight: 500;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 100px;
    outline: none;
    cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,0.15), 0 2px 6px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
}
input[type=range]:hover::-webkit-slider-thumb {
    box-shadow: 0 0 0 6px rgba(26,115,232,0.2), 0 2px 8px rgba(0,0,0,0.12);
    transform: scale(1.1);
}
input[type=range]::-moz-range-thumb {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary);
    cursor: pointer;
}

/* ── Live Preview Box ── */
.live-preview {
    background: linear-gradient(135deg, #fffbeb 0%, #fef9f0 100%);
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin: 0 0 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}
.live-preview .material-icons-round { color: var(--warning); font-size: 20px; flex-shrink: 0; }
.preview-text { flex: 1; }
.preview-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 4px;
}
.preview-sizes {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'DM Mono', monospace;
    font-size: 0.88rem;
    font-weight: 500;
}
.preview-original  { color: var(--text-muted); text-decoration: line-through; }
.preview-arrow     { color: #f59e0b; font-size: 0.9rem; font-weight: 700; }
.preview-estimated { color: #1a73e8; font-weight: 700; }
.preview-saving {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 100px;
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #a7f3d0;
    flex-shrink: 0;
    white-space: nowrap;
    transition: all 0.3s ease;
}

/* ── Compress Button ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, #1557b0 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.975rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: 'DM Sans', sans-serif;
    letter-spacing: 0.1px;
    box-shadow: 0 4px 12px rgba(26,115,232,0.25);
    position: relative;
    overflow: hidden;
}
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
    pointer-events: none;
}
.btn:hover {
    background: linear-gradient(135deg, #1e7fe8 0%, var(--primary) 100%);
    box-shadow: 0 6px 20px rgba(26,115,232,0.35);
    transform: translateY(-1px);
}
.btn:active { transform: scale(0.98) translateY(0); box-shadow: 0 2px 8px rgba(26,115,232,0.2); }
.btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

/* ── Results ── */
.results { animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.success-box { text-align: center; }

.success-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    background: linear-gradient(135deg, #e6f4ea 0%, #d1fae5 100%);
    border-radius: 50%;
    margin-bottom: 14px;
    box-shadow: 0 0 0 8px rgba(30,142,62,0.08);
}
.success-icon {
    font-size: 42px;
    color: var(--success);
    animation: check-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.success-box h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 4px; }
.success-box .sub { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 24px; }

.stats { display: flex; gap: 12px; margin-bottom: 24px; }
.stat-box {
    flex: 1;
    background: var(--background);
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: transform 0.2s ease;
}
.stat-box:hover { transform: translateY(-2px); }
.stat-box.highlight {
    background: linear-gradient(135deg, var(--success-light) 0%, #d1fae5 100%);
    border-color: #86efac;
}
.stat-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    font-weight: 700;
}
.stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    color: var(--text-main);
}
.stat-box.highlight .stat-value { color: var(--success); }
.stat-savings { font-size: 0.72rem; color: var(--success); font-weight: 700; }

.download-btn {
    background: linear-gradient(135deg, var(--success) 0%, #177030 100%);
    box-shadow: 0 4px 12px rgba(30,142,62,0.25);
    margin-bottom: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px 24px;
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.975rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: 'DM Sans', sans-serif;
    position: relative;
    overflow: hidden;
}
.download-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
    pointer-events: none;
}
.download-btn:hover {
    background: linear-gradient(135deg, #25a34a 0%, var(--success) 100%);
    box-shadow: 0 6px 20px rgba(30,142,62,0.35);
    transform: translateY(-1px);
}

.btn-text {
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 0.875rem;
    cursor: pointer;
    font-weight: 500;
    padding: 8px;
    text-decoration: underline;
    width: 100%;
    font-family: 'DM Sans', sans-serif;
    transition: color 0.15s;
}
.btn-text:hover { color: var(--text-main); }

/* ── Footer ── */
.footer {
    text-align: center;
    font-size: 0.775rem;
    color: var(--text-muted);
    line-height: 1.8;
    animation: fadeUp 0.5s ease 0.18s both;
}
.footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.15s;
}
.footer a:hover { opacity: 0.75; text-decoration: underline; }
.footer .sep { margin: 0 7px; opacity: 0.35; }
.github-icon {
    width: 14px;
    height: 14px;
    fill: currentColor;
    vertical-align: middle;
}

.hidden { display: none !important; }
