/* ── Design Tokens ─────────────────────────────────────────────────────── */
:root {
    --red: #E63946;
    --red-dark: #c1121f;
    --red-light: #fff1f2;
    --ink: #0d0d0d;
    --ink-2: #3d3d3d;
    --ink-3: #888;
    --paper: #ffffff;
    --bg: #f6f5f3;
    --border: #e8e6e2;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 2px 12px rgba(0, 0, 0, .07);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, .12);
    --font-head: 'Syne', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --transition: .2s ease;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.6;
}

img,
svg {
    display: block;
    max-width: 100%;
}

a {
    color: var(--red);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button {
    cursor: pointer;
    font-family: var(--font-body);
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 24px;
}

.main-content {
    min-height: calc(100vh - 64px - 240px);
}

/* ── Navbar ─────────────────────────────────────────────────────────────── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: 64px;
}

.navbar__inner {
    display: flex;
    align-items: center;
    gap: 32px;
    height: 100%;
}

.navbar__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-head);
    font-size: 1.2rem;
    color: var(--ink);
    text-decoration: none;
}

.navbar__brand strong {
    color: var(--red);
}

.navbar__menu {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-left: auto;
}

.navbar__link {
    color: var(--ink-2);
    font-size: .95rem;
    transition: color var(--transition);
}

.navbar__link:hover {
    color: var(--red);
    text-decoration: none;
}

.navbar__tools-trigger {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: .95rem;
    color: var(--ink-2);
    cursor: pointer;
    padding: 8px 0;
}

.navbar__tools-trigger:hover {
    color: var(--red);
}

.navbar__tools-trigger:hover .tools-dropdown {
    display: block;
}

.tools-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 16px;
    width: 520px;
    z-index: 200;
}

.tools-dropdown__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.tools-dropdown__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--ink-2);
    font-size: .88rem;
    transition: background var(--transition), color var(--transition);
}

.tools-dropdown__item:hover {
    background: var(--red-light);
    color: var(--red);
    text-decoration: none;
}

.tools-dropdown__icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.navbar__toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    padding: 4px;
}

.navbar__toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
    transition: var(--transition);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius);
    border: none;
    font-family: var(--font-body);
    font-size: .95rem;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn--primary {
    background: var(--red);
    color: #fff;
}

.btn--primary:hover {
    background: var(--red-dark);
    color: #fff;
    text-decoration: none;
}

.btn--outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--ink-2);
}

.btn--outline:hover {
    border-color: var(--red);
    color: var(--red);
}

.btn--ghost {
    background: transparent;
    color: var(--ink-2);
}

.btn--ghost:hover {
    background: var(--bg);
}

.btn--google {
    background: #fff;
    border: 1.5px solid var(--border);
    color: var(--ink);
}

.btn--google:hover {
    border-color: #4285F4;
    color: #4285F4;
}

.btn--google img {
    width: 18px;
}

.btn--full {
    width: 100%;
}

.btn--sm {
    padding: 7px 16px;
    font-size: .875rem;
}

.btn--lg {
    padding: 14px 32px;
    font-size: 1.05rem;
}

.btn--icon {
    padding: 8px;
    border-radius: 8px;
}

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: .875rem;
    font-weight: 500;
    color: var(--ink-2);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: .95rem;
    background: #fff;
    transition: border var(--transition);
    outline: none;
    color: var(--ink);
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, .1);
}

.form-group input::placeholder {
    color: var(--ink-3);
}

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: .9rem;
}

.alert--error {
    background: #fff1f2;
    color: #c1121f;
    border: 1px solid #ffc1c4;
}

.alert--success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.alert--info {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

/* ── Auth ───────────────────────────────────────────────────────────────── */
.auth-section {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
}

.auth-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-card h1 {
    font-family: var(--font-head);
    font-size: 1.75rem;
}

.auth-sub {
    color: var(--ink-3);
    font-size: .95rem;
    margin-top: -12px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ink-3);
    font-size: .85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-footer {
    text-align: center;
    font-size: .875rem;
    color: var(--ink-3);
}

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero {
    padding: 80px 0 60px;
    text-align: center;
    background: linear-gradient(170deg, #fff 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
}

.hero h1 {
    font-family: var(--font-head);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    color: var(--ink);
    max-width: 720px;
    margin: 0 auto 16px;
}

.hero h1 span {
    color: var(--red);
}

.hero p {
    color: var(--ink-2);
    font-size: 1.1rem;
    max-width: 560px;
    margin: 0 auto 32px;
}

.hero__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

/* ── Tools Grid ─────────────────────────────────────────────────────────── */
.tools-section {
    padding: 64px 0;
}

.tools-section h2 {
    font-family: var(--font-head);
    font-size: 1.5rem;
    margin-bottom: 32px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.tool-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 16px;
    text-align: center;
    text-decoration: none;
    color: var(--ink);
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.tool-card:hover {
    border-color: var(--red);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    text-decoration: none;
    color: var(--ink);
}

.tool-card__icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: var(--red-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--red);
}

.tool-card h3 {
    font-size: .9rem;
    font-weight: 600;
}

.tool-card p {
    font-size: .8rem;
    color: var(--ink-3);
}

/* ── Tool Page ──────────────────────────────────────────────────────────── */
.tool-page {
    padding: 56px 0;
}

.tool-page__header {
    text-align: center;
    margin-bottom: 40px;
}

.tool-page__header h1 {
    font-family: var(--font-head);
    font-size: 2.2rem;
}

.tool-page__header p {
    color: var(--ink-2);
    margin-top: 8px;
}

.tool-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--red-light);
    color: var(--red);
    font-size: .8rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 16px;
}

/* ── Drop Zone ──────────────────────────────────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    background: #fff;
    padding: 60px 40px;
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
    position: relative;
    max-width: 680px;
    margin: 0 auto;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--red);
    background: var(--red-light);
}

.drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.drop-zone__icon {
    width: 72px;
    height: 72px;
    background: var(--red-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
}

.drop-zone h3 {
    font-family: var(--font-head);
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.drop-zone p {
    color: var(--ink-3);
    font-size: .9rem;
}

.drop-zone__hint {
    margin-top: 16px;
    font-size: .8rem;
    color: var(--ink-3);
}

/* ── File List ──────────────────────────────────────────────────────────── */
.file-list {
    max-width: 680px;
    margin: 24px auto 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-item__icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.file-item__info {
    flex: 1;
    min-width: 0;
}

.file-item__name {
    font-size: .9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item__size {
    font-size: .8rem;
    color: var(--ink-3);
}

.file-item__remove {
    background: none;
    border: none;
    color: var(--ink-3);
    font-size: 1.1rem;
    padding: 4px;
    border-radius: 4px;
}

.file-item__remove:hover {
    color: var(--red);
    background: var(--red-light);
}

/* ── Progress Bar ───────────────────────────────────────────────────────── */
.progress-wrap {
    max-width: 680px;
    margin: 16px auto 0;
    display: none;
}

.progress-wrap.active {
    display: block;
}

.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    background: var(--red);
    border-radius: 99px;
    width: 0%;
    transition: width .3s ease;
}

.progress-label {
    font-size: .8rem;
    color: var(--ink-3);
    margin-top: 6px;
}

/* ── Options Panel ──────────────────────────────────────────────────────── */
.options-panel {
    max-width: 680px;
    margin: 24px auto 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: none;
}

.options-panel.active {
    display: block;
}

.options-panel h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ── Result Panel ───────────────────────────────────────────────────────── */
.result-panel {
    max-width: 680px;
    margin: 24px auto 0;
    text-align: center;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-lg);
    padding: 32px;
    display: none;
}

.result-panel.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.result-panel__icon {
    font-size: 3rem;
}

.result-panel h3 {
    font-family: var(--font-head);
    font-size: 1.3rem;
    color: #16a34a;
}

/* ── Dashboard ──────────────────────────────────────────────────────────── */
.dashboard-header {
    padding: 48px 0 32px;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.dashboard-header h1 {
    font-family: var(--font-head);
    font-size: 1.75rem;
}

.dashboard-header p {
    color: var(--ink-3);
}

.dashboard-body {
    padding: 40px 0;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-card__value {
    font-family: var(--font-head);
    font-size: 2rem;
    font-weight: 800;
}

.stat-card__label {
    font-size: .875rem;
    color: var(--ink-3);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.history-table th {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink-3);
}

.history-table td {
    font-size: .9rem;
}

.history-table tr:hover td {
    background: var(--bg);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
}

.badge--done {
    background: #dcfce7;
    color: #16a34a;
}

.badge--failed {
    background: #fee2e2;
    color: #dc2626;
}

.badge--processing {
    background: #fef9c3;
    color: #ca8a04;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.footer {
    background: var(--ink);
    color: #aaa;
    padding: 56px 0 0;
}

.footer__inner {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    padding-bottom: 48px;
}

.footer__brand .navbar__brand {
    color: #fff;
    margin-bottom: 12px;
}

.footer__brand .navbar__brand strong {
    color: var(--red);
}

.footer__brand p {
    font-size: .875rem;
    line-height: 1.7;
}

.footer__col h4 {
    color: #fff;
    font-family: var(--font-head);
    font-size: .95rem;
    margin-bottom: 16px;
}

.footer__col a {
    display: block;
    font-size: .875rem;
    color: #888;
    margin-bottom: 8px;
    transition: color var(--transition);
}

.footer__col a:hover {
    color: #fff;
    text-decoration: none;
}

.footer__bottom {
    border-top: 1px solid #222;
    padding: 20px 0;
    text-align: center;
    font-size: .8rem;
}

/* ── Loader ──────────────────────────────────────────────────────────────── */
.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .navbar__toggle {
        display: flex;
    }

    .navbar__menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: #fff;
        border-bottom: 1px solid var(--border);
        padding: 20px 24px;
        gap: 16px;
    }

    .navbar__menu.open {
        display: flex;
    }

    .tools-dropdown {
        position: static;
        transform: none;
        width: 100%;
        box-shadow: none;
    }

    .footer__inner {
        grid-template-columns: 1fr 1fr;
    }

    .auth-card {
        padding: 32px 24px;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .footer__inner {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 1.75rem;
    }
}