:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --accent: #6366f1;
    --accent-dark: #4f46e5;
    --radius-lg: 1.25rem;
    --radius-xl: 1.75rem;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.12);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
}

body::before {
    width: 520px;
    height: 520px;
    top: -180px;
    right: -120px;
    background: rgba(99, 102, 241, 0.18);
}

body::after {
    width: 420px;
    height: 420px;
    bottom: -140px;
    left: -100px;
    background: rgba(45, 212, 191, 0.14);
}

.page-wrap {
    position: relative;
    z-index: 1;
}

.site-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: var(--shadow-sm);
}

.logo-mark {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #2dd4bf 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.logo-btn {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
    background: transparent;
    border: 0;
    padding: 0;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent-dark);
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: rgba(99, 102, 241, 0.14);
    transform: translateX(-2px);
}

/* Hero */
.hero-title {
    font-size: clamp(2.25rem, 5vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.1;
    color: var(--text);
}

.hero-accent {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 45%, #2dd4bf 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

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

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-muted);
    max-width: 32rem;
    margin: 1rem auto 0;
    line-height: 1.6;
}

.hero-privacy {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #059669;
}

.hero-privacy svg {
    flex-shrink: 0;
    opacity: 0.85;
}

.status-box {
    padding: 1rem;
    text-align: center;
}

.file-input-hidden {
    display: none;
}

/* Category cards */
.category-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1.25rem;
    max-width: 56rem;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.5rem;
    }
}

.category-card {
    position: relative;
    display: flex;
    flex-direction: column;
    text-align: left;
    padding: 1.75rem;
    border-radius: var(--radius-xl);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    overflow: visible;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    width: 100%;
}

.category-card::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.category-card[role='button']:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.category-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    z-index: 5;
}

.category-card:has(.info-hint:hover),
.category-card:has(.info-hint:focus-visible) {
    z-index: 10;
}

.category-card:hover .card-arrow {
    opacity: 1;
    transform: translate(2px, -2px);
}

.category-card[data-category='images'] { --card-accent: #3b82f6; --card-soft: #eff6ff; }
.category-card[data-category='documents'] { --card-accent: #10b981; --card-soft: #ecfdf5; }
.category-card[data-category='audio'] { --card-accent: #8b5cf6; --card-soft: #f5f3ff; }
.category-card[data-category='video'] { --card-accent: #f97316; --card-soft: #fff7ed; }

.category-card[data-category='images']:hover { border-color: rgba(59, 130, 246, 0.35); }
.category-card[data-category='documents']:hover { border-color: rgba(16, 185, 129, 0.35); }
.category-card[data-category='audio']:hover { border-color: rgba(139, 92, 246, 0.35); }
.category-card[data-category='video']:hover { border-color: rgba(249, 115, 22, 0.35); }

.category-card[data-category='images']::before { background: linear-gradient(135deg, rgba(59,130,246,0.06), transparent); }
.category-card[data-category='documents']::before { background: linear-gradient(135deg, rgba(16,185,129,0.06), transparent); }
.category-card[data-category='audio']::before { background: linear-gradient(135deg, rgba(139,92,246,0.06), transparent); }
.category-card[data-category='video']::before { background: linear-gradient(135deg, rgba(249,115,22,0.06), transparent); }

.category-card:hover::before {
    opacity: 1;
}

.card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.card-icon {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-soft);
    color: var(--card-accent);
    transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.card-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.category-card:hover .card-icon {
    transform: scale(1.05);
    background: var(--card-accent);
    color: #ffffff;
}

.card-arrow {
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-soft);
    color: var(--card-accent);
    opacity: 0.5;
    transition: all 0.25s ease;
}

.card-title-row,
.converter-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.card-title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.info-hint {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 9999px;
    color: var(--text-muted);
    background: #f1f5f9;
    cursor: help;
    flex-shrink: 0;
    outline: none;
    transition: color 0.2s ease, background 0.2s ease;
}

.info-hint:hover,
.info-hint:focus-visible,
.info-hint:focus-within {
    color: var(--accent-dark);
    background: #eef2ff;
    z-index: 200;
}

.info-hint-light {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.18);
}

.info-hint-light:hover,
.info-hint-light:focus-visible,
.info-hint-light:focus-within {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.28);
    z-index: 200;
}

.info-tooltip {
    position: absolute;
    top: 50%;
    left: calc(100% + 0.5rem);
    transform: translateY(-50%);
    z-index: 201;
    min-width: 14rem;
    max-width: 20rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.65rem;
    background: #1e293b;
    color: #f8fafc;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.55;
    text-align: left;
    white-space: normal;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.info-tooltip::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 100%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #1e293b;
}

.info-tooltip-label {
    display: inline-block;
    font-weight: 700;
    color: #94a3b8;
    margin-right: 0.25rem;
}

.info-hint:hover .info-tooltip,
.info-hint:focus-within .info-tooltip {
    opacity: 1;
    visibility: visible;
}

.converter-title-row .converter-title {
    margin: 0;
}

.card-hint-slot,
#converterHintSlot {
    display: inline-flex;
}

@media (min-width: 768px) {
    .category-card:nth-child(even) .info-tooltip {
        left: auto;
        right: calc(100% + 0.5rem);
    }

    .category-card:nth-child(even) .info-tooltip::before {
        right: auto;
        left: 100%;
        border-right-color: transparent;
        border-left-color: #1e293b;
    }
}

/* Views */
.view-transition {
    animation: fadeUp 0.45s ease both;
}

.hidden-view {
    display: none !important;
}

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

/* Converter panel */
.converter-panel {
    max-width: 40rem;
    margin: 0 auto;
    background: var(--surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    overflow: visible;
}

.converter-header {
    padding: 2rem;
    color: white;
    position: relative;
    overflow: visible;
}

.converter-header::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    top: -80px;
    right: -40px;
    pointer-events: none;
}

.converter-header.theme-images { background: linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #06b6d4 100%); }
.converter-header.theme-documents { background: linear-gradient(135deg, #059669 0%, #10b981 50%, #34d399 100%); }
.converter-header.theme-audio { background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 50%, #a78bfa 100%); }
.converter-header.theme-video { background: linear-gradient(135deg, #ea580c 0%, #f97316 50%, #fb923c 100%); }

.converter-header-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.converter-header-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    backdrop-filter: blur(4px);
}

.converter-header-icon svg {
    width: 1.35rem;
    height: 1.35rem;
}

.converter-body {
    padding: 2rem;
}

.step-block + .step-block {
    margin-top: 1.75rem;
}

.step-label {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.85rem;
}

.step-number {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#dropZone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    background: #f8fafc;
    transition: all 0.2s ease;
}

#dropZone:hover {
    border-color: #818cf8;
    background: #eef2ff;
}

#dropZone.drag-over {
    border-color: #6366f1;
    background: #eef2ff;
    transform: scale(1.01);
}

#dropZone.has-preview {
    padding: 1.25rem;
}

#dropZone.has-preview:hover {
    transform: none;
}

.drop-icon {
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto 1rem;
    border-radius: 1rem;
    background: white;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

#dropZone:hover .drop-icon {
    transform: translateY(-3px);
}

#fileNameDisplay {
    font-weight: 600;
    color: var(--text);
}

.file-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
}

.preview-frame {
    width: 100%;
    max-height: 280px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #f1f5f9;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-frame img {
    display: block;
    max-width: 100%;
    max-height: 280px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.preview-info {
    text-align: center;
    width: 100%;
}

.preview-info p {
    margin: 0;
}

#previewFileName {
    font-weight: 600;
    color: var(--text);
    word-break: break-all;
}

.preview-clear {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 9999px;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.preview-clear:hover {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fef2f2;
}

#fileNameDisplay.has-file {
    color: var(--accent-dark);
}

.format-select {
    width: 100%;
    appearance: none;
    background: #f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 1rem center;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.85rem 2.5rem 0.85rem 1rem;
    font-weight: 600;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.format-select:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.convert-btn {
    width: 100%;
    margin-top: 0.5rem;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1.05rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #8b5cf6 100%);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s;
}

.convert-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.4);
}

.convert-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.convert-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.status-red { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.status-blue { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.status-green { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.status-orange { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }

#statusMessage {
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.45;
    word-break: break-word;
    transition: opacity 0.2s ease;
}

.converter-status-slot {
    max-width: 40rem;
    margin: 1rem auto 0;
    min-height: 3.25rem;
}

.converter-status {
    width: 100%;
}

#statusMessage.status-hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.site-footer {
    text-align: center;
    padding: 2.5rem 1.5rem 3rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.site-footer p {
    margin: 0;
}

.site-footer-meta {
    margin-top: 0.35rem !important;
    font-size: 0.8rem;
    opacity: 0.85;
}

.seo-section {
    max-width: 56rem;
    margin: 3rem auto 0;
    padding: 0 0 1rem;
}

.seo-heading {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-align: center;
    color: var(--text);
    margin: 0 0 0.75rem;
}

.seo-intro {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 40rem;
    margin: 0 auto 1.75rem;
}

.seo-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .seo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
}

.seo-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.seo-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.4rem;
    color: var(--text);
}

.seo-card p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--text-muted);
}

.site-footer strong {
    color: var(--text);
    font-weight: 700;
}

.container {
    width: 100%;
    max-width: 72rem;
    margin-left: auto;
    margin-right: auto;
}

.hidden {
    display: none !important;
}

.text-muted-sm {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.5rem;
}

.converter-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.converter-subtitle {
    opacity: 0.9;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.nav-inner,
.main-inner {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.dashboard-main {
    padding-top: 3rem;
    padding-bottom: 2rem;
}

.categories-heading {
    grid-column: 1 / -1;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 0.25rem;
}

.converter-main {
    padding-top: 3rem;
    padding-bottom: 2rem;
}
