:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
    --shadow-lg: 0 10px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.08);
    --drop-bg: #eff6ff;
    --drop-border: #93c5fd;
}

[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --bg: #0f172a;
    --card: #1e293b;
    --text: #f1f5f9;
    --text-light: #94a3b8;
    --border: #334155;
    --success: #34d399;
    --danger: #f87171;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.2);
    --shadow-lg: 0 10px 25px -5px rgb(0 0 0 / 0.4);
    --drop-bg: #1e3a5f;
    --drop-border: #3b82f6;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0.9rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
    transition: background 0.3s, border-color 0.3s;
}

.header-content {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--primary);
    text-decoration: none;
}

.logo-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.nav-links {
    display: flex;
    gap: 1.4rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover { color: var(--primary); }

.theme-toggle {
    background: var(--bg);
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    transition: all 0.2s;
    color: var(--text);
}

.theme-toggle:hover { background: var(--border); }

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2.2rem 1.5rem;
}

.hero {
    text-align: center;
    margin-bottom: 2.2rem;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.7rem;
    line-height: 1.3;
}

.hero p {
    font-size: 1.05rem;
    color: var(--text-light);
    max-width: 580px;
    margin: 0 auto;
}

.drop-zone {
    background: var(--card);
    border: 2.5px dashed var(--drop-border);
    border-radius: 18px;
    padding: 3.2rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: var(--shadow);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary);
    background: var(--drop-bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.drop-zone.dragover { border-style: solid; }

.drop-icon {
    width: 76px;
    height: 76px;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.3rem;
    font-size: 2.1rem;
    transition: transform 0.3s;
}

.drop-zone:hover .drop-icon { transform: scale(1.08); }

[data-theme="dark"] .drop-icon {
    background: linear-gradient(135deg, #1e3a5f, #1e40af);
}

.drop-zone h2 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 0.45rem;
    color: var(--text);
}

.drop-zone p {
    color: var(--text-light);
    margin-bottom: 1.4rem;
    font-size: 0.95rem;
}

.browse-btn {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.8rem 1.9rem;
    border-radius: 11px;
    font-weight: 600;
    font-size: 0.98rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

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

#fileInput { display: none; }

.file-info {
    display: none;
    background: var(--card);
    border-radius: 14px;
    padding: 1.3rem 1.4rem;
    margin-top: 1.4rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    animation: fadeIn 0.35s ease;
}

.file-info.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.file-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-icon {
    width: 48px;
    height: 48px;
    background: #dbeafe;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

[data-theme="dark"] .file-icon { background: #1e3a5f; }

.file-details { flex: 1; min-width: 0; }

.file-details h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
    word-break: break-all;
}

.file-details p {
    font-size: 0.88rem;
    color: var(--text-light);
}

.remove-file {
    background: #fee2e2;
    color: var(--danger);
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

[data-theme="dark"] .remove-file { background: #450a0a; }
.remove-file:hover { background: #fecaca; }
[data-theme="dark"] .remove-file:hover { background: #7f1d1d; }

.options-section {
    display: none;
    margin-top: 1.5rem;
    animation: fadeIn 0.35s ease;
}

.options-section.active { display: block; }

.options-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.9rem;
    color: var(--text);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 0.85rem;
}

.option-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 13px;
    padding: 1rem 0.7rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.option-card:hover {
    border-color: var(--primary-light);
    background: var(--drop-bg);
    transform: translateY(-2px);
}

.option-card.selected {
    border-color: var(--primary);
    background: var(--drop-bg);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.option-card .icon {
    font-size: 1.6rem;
    margin-bottom: 0.4rem;
}

.option-card .label {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
}

.advanced-toggle {
    margin-top: 1rem;
    text-align: center;
}

.advanced-toggle button {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}

.advanced-options {
    display: none;
    margin-top: 0.9rem;
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 0.85rem;
}

.advanced-options.show { display: grid; }

.action-area {
    display: none;
    margin-top: 1.6rem;
    text-align: center;
    animation: fadeIn 0.35s ease;
}

.action-area.active { display: block; }

.get-file-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    padding: 0.95rem 2.6rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 13px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
    transition: all 0.25s;
}

.get-file-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.get-file-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.secure-note {
    margin-top: 0.75rem;
    font-size: 0.84rem;
    color: var(--text-light);
}

.features {
    margin-top: 3.8rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.3rem;
}

.feature-card {
    background: var(--card);
    padding: 1.4rem;
    border-radius: 14px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-align: center;
    transition: transform 0.2s;
}

.feature-card:hover { transform: translateY(-3px); }

.feature-card .f-icon {
    width: 48px;
    height: 48px;
    background: #dbeafe;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.9rem;
    font-size: 1.3rem;
}

[data-theme="dark"] .feature-card .f-icon { background: #1e3a5f; }

.feature-card h3 { font-size: 1.02rem; margin-bottom: 0.35rem; }
.feature-card p { font-size: 0.88rem; color: var(--text-light); }

.how-it-works {
    margin-top: 3.8rem;
    text-align: center;
}

.how-it-works h2 {
    font-size: 1.5rem;
    margin-bottom: 1.8rem;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1.3rem;
}

.step {
    background: var(--card);
    padding: 1.4rem;
    border-radius: 14px;
    border: 1px solid var(--border);
}

.step-num {
    width: 34px;
    height: 34px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin: 0 auto 0.9rem;
    font-size: 0.95rem;
}

.step h3 { font-size: 1.02rem; margin-bottom: 0.35rem; }
.step p { font-size: 0.88rem; color: var(--text-light); }

/* Processing Overlay */
.processing-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.processing-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.processing-box {
    background: var(--card);
    border-radius: 20px;
    padding: 2.5rem 2.8rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 340px;
    width: 90%;
}

.spinner {
    width: 56px;
    height: 56px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 1.4rem;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.processing-box h3 { font-size: 1.15rem; margin-bottom: 0.4rem; }
.processing-box p { font-size: 0.9rem; color: var(--text-light); }

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 10px;
    margin-top: 1.3rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
}

/* Confirmation Modal */
.confirm-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1100;
    align-items: center;
    justify-content: center;
}

.confirm-modal.active {
    display: flex;
    animation: fadeIn 0.25s ease;
}

.confirm-box {
    background: var(--card);
    border-radius: 18px;
    padding: 2rem 2.2rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 380px;
    width: 90%;
    animation: scaleIn 0.25s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.confirm-box .success-icon {
    width: 60px;
    height: 60px;
    background: #d1fae5;
    color: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 1.2rem;
}

[data-theme="dark"] .confirm-box .success-icon { background: #064e3b; }

.confirm-box h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.confirm-box p { font-size: 0.92rem; color: var(--text-light); margin-bottom: 1.6rem; }

.confirm-actions {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
}

.confirm-actions button {
    padding: 0.75rem 1.4rem;
    border-radius: 11px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-download { background: var(--primary); color: white; }
.btn-download:hover { background: var(--primary-dark); }

.btn-back {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border) !important;
}

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

.page-content {
    max-width: 780px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

.page-content h1 { font-size: 1.9rem; margin-bottom: 1.2rem; }
.page-content h2 { font-size: 1.3rem; margin: 2rem 0 0.8rem; color: var(--primary); }
.page-content p { margin-bottom: 1rem; color: var(--text-light); font-size: 1rem; }
.page-content ul { margin: 0.8rem 0 1.2rem 1.4rem; color: var(--text-light); }
.page-content li { margin-bottom: 0.45rem; }

footer {
    margin-top: 4.5rem;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 1.8rem 1.5rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.88rem;
}

footer a { color: var(--primary); text-decoration: none; margin: 0 0.3rem; }
footer a:hover { text-decoration: underline; }

.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: var(--bg);
    padding: 0.85rem 1.4rem;
    border-radius: 11px;
    font-weight: 500;
    font-size: 0.92rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1200;
    max-width: 90%;
    text-align: center;
}

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

@media (max-width: 640px) {
    .hero h1 { font-size: 1.55rem; }
    .drop-zone { padding: 2.3rem 1.1rem; }
    .options-grid { grid-template-columns: repeat(2, 1fr); }
    .nav-links a:not(.theme-toggle) { display: none; }
    .confirm-actions { flex-direction: column; }
}

/* Target Size Box */
.target-size-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.2rem 1.4rem;
    margin-top: 1.2rem;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.target-label {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: var(--text);
}

.target-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
    margin-bottom: 0.7rem;
}

.target-btn {
    background: var(--bg);
    border: 2px solid var(--border);
    color: var(--text);
    padding: 0.55rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.target-btn:hover {
    border-color: var(--primary-light);
}

.target-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.target-note {
    font-size: 0.82rem;
    color: var(--text-light);
}

/* Settings Panel */
#settingsPanel, .settings-panel {
    display: none;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.2rem 1.4rem;
    margin-top: 1.2rem;
    animation: fadeIn 0.3s ease;
}

.settings-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.9rem;
    color: var(--text);
}

.setting-row {
    margin-bottom: 1rem;
}

.setting-row label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text);
}

.setting-row input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

.setting-note {
    font-size: 0.82rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}
