/* === CSS Variables === */
:root {
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f5f5f5;
    --text-primary: #1a1a1a;
    --text-secondary: #6b6b6b;
    --text-muted: #9a9a9a;
    --border-color: #e8e8e8;
    --border-hover: #d0d0d0;
    --accent: #2d2d2d;
    --accent-hover: #1a1a1a;
    --success: #22c55e;
    --error: #ef4444;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --font-mono: 'JetBrains Mono', monospace;
    --font-sans: 'Sora', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: 0.2s ease;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* === Layout === */
.layout {
    display: flex;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
}

/* === Container === */
.container {
    flex: 1;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Sidebar === */
.sidebar {
    width: 260px;
    background: #1e1e1e;
    border-left: 1px solid #2a2a2a;
    padding: 24px 16px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 8px 12px;
    margin-bottom: 8px;
}

.sidebar-title {
    font-size: 13px;
    font-weight: 600;
    color: #6b6b6b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: #a0a0a0;
    font-size: 14px;
    transition: all var(--transition);
}

.nav-item:hover {
    background: #2a2a2a;
    color: #ffffff;
}

.nav-item.active {
    background: #2d2d2d;
    color: #ffffff;
    font-weight: 500;
}

.nav-emoji {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-divider {
    height: 1px;
    background: #333333;
    margin: 8px 12px;
}

.nav-category {
    font-size: 11px;
    font-weight: 600;
    color: #555555;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px 12px 8px;
    margin-top: 8px;
}

.nav-category:first-child {
    margin-top: 0;
    padding-top: 8px;
}

/* === Header === */
.header {
    padding: 32px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-emoji {
    font-size: 24px;
}

.logo-text {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* === Mobile Tools Nav === */
.mobile-tools {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}

.mobile-tools-label {
    font-size: 16px;
    flex-shrink: 0;
}

.mobile-tools-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
}

.mobile-tools-list::-webkit-scrollbar {
    display: none;
}

.mobile-tool {
    flex-shrink: 0;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--transition);
}

.mobile-tool:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.mobile-tool.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* === Main === */
.main {
    flex: 1;
    padding-bottom: 48px;
}

/* === Hero === */
.hero {
    text-align: center;
    margin-bottom: 40px;
}

.hero h1 {
    font-family: var(--font-sans);
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.2;
}

.subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* === Converter Card === */
.converter-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
}

/* === Upload Zone === */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-tertiary);
}

.upload-zone:hover {
    border-color: var(--border-hover);
    background: var(--bg-secondary);
}

.upload-zone.dragover {
    border-color: var(--accent);
    background: var(--bg-secondary);
    transform: scale(1.01);
}

.upload-zone.has-file {
    display: none;
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-emoji {
    font-size: 48px;
    margin-bottom: 8px;
    filter: grayscale(0.2);
}

.upload-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.upload-hint {
    font-size: 13px;
    color: var(--text-muted);
}

/* === File Info === */
.file-info {
    margin-bottom: 24px;
}

.file-info[hidden] {
    display: none;
}

.file-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.file-emoji {
    font-size: 32px;
    flex-shrink: 0;
}

.file-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-name {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 12px;
    color: var(--text-muted);
}

.remove-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* === Files List (Multiple Files) === */
.files-list {
    margin-bottom: 24px;
}

.files-list[hidden] {
    display: none;
}

.files-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.files-list-header strong {
    color: var(--text-primary);
    font-weight: 600;
}

.remove-all-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.remove-all-btn:hover {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

.files-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.file-item .file-emoji {
    font-size: 24px;
    flex-shrink: 0;
}

.file-item .file-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-item .file-name {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .file-size {
    font-size: 11px;
    color: var(--text-muted);
}

.remove-file-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-secondary);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.remove-file-btn:hover {
    background: var(--error);
    color: white;
    transform: scale(1.1);
}

/* === Quality Control === */
.quality-control {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.quality-control label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.quality-control #qualityValue {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent);
}

.quality-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition);
}

.quality-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.quality-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: var(--shadow-md);
}

.quality-hints {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

/* === Resize Control === */
.resize-control {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.resize-control > label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.resize-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
}

.resize-inputs input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color var(--transition);
}

.resize-inputs input:focus {
    outline: none;
    border-color: var(--accent);
}

.resize-inputs input::placeholder {
    color: var(--text-muted);
}

.resize-x {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.resize-ratio {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.resize-ratio input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

/* === Convert Button === */
.convert-btn {
    width: 100%;
    padding: 16px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: var(--shadow-sm);
}

.convert-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.convert-btn:active:not(:disabled) {
    transform: translateY(0);
}

.convert-btn:disabled {
    background: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.convert-btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-emoji {
    font-size: 18px;
}

/* === Status === */
.status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    margin-top: 16px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    font-size: 14px;
    font-weight: 500;
}

.status[hidden] {
    display: none;
}

.status-emoji {
    font-size: 18px;
}

.status.success {
    background: #f0fdf4;
    color: var(--success);
}

.status.error {
    background: #fef2f2;
    color: var(--error);
}

.status.loading {
    color: var(--text-secondary);
}

/* === Loading Animation === */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status.loading .status-emoji {
    animation: pulse 1.5s ease-in-out infinite;
}

/* === Features === */
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 48px;
}

.feature {
    text-align: center;
    padding: 20px 12px;
}

.feature-emoji {
    font-size: 28px;
    margin-bottom: 12px;
    display: block;
}

.feature-content h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.feature-content p {
    font-size: 13px;
    color: var(--text-muted);
}

/* === Ad Placeholders === */
.ad-placeholder {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 24px;
    min-height: 90px;
    background: var(--bg-tertiary);
}

.ad-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
}

.ad-horizontal {
    margin-top: 48px;
    min-height: 100px;
}

.ad-sidebar {
    margin-top: auto;
    padding-top: 24px;
    min-height: 250px;
    background: #252525;
    border-color: #333333;
}

.ad-sidebar .ad-label {
    color: #555555;
}

/* === Footer === */
.footer {
    padding: 24px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.footer-links {
    margin-top: 8px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--text-secondary);
    text-decoration: underline;
}

/* === Responsive === */
@media (max-width: 900px) {
    .sidebar {
        width: 220px;
    }
}

@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    .mobile-tools {
        display: flex;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-left: none;
        border-top: 1px solid #2a2a2a;
        order: 1;
    }

    .container {
        order: 0;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
    }

    .nav-item {
        padding: 8px 12px;
        font-size: 13px;
    }

    .nav-divider {
        display: none;
    }

    .ad-sidebar {
        margin-top: 16px;
        min-height: 100px;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 0 16px;
    }

    .hero h1 {
        font-size: 26px;
    }

    .converter-card {
        padding: 24px;
    }

    .upload-zone {
        padding: 36px 16px;
    }

    .upload-emoji {
        font-size: 40px;
    }

    .features {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-top: 36px;
    }

    .feature {
        display: flex;
        align-items: center;
        text-align: left;
        gap: 16px;
        padding: 16px;
        background: var(--bg-secondary);
        border-radius: var(--radius-md);
        border: 1px solid var(--border-color);
    }

    .feature-emoji {
        font-size: 24px;
        margin-bottom: 0;
    }

    .feature-content h3 {
        margin-bottom: 2px;
    }

    .sidebar {
        padding: 16px;
    }

    .nav-item {
        padding: 8px 10px;
        gap: 8px;
    }

    .nav-emoji {
        font-size: 16px;
    }
}

/* === Focus States === */
.upload-zone:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.convert-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* === Selection === */
::selection {
    background: var(--accent);
    color: white;
}

/* === Home Page === */
.home-tools {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.home-category-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.home-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.home-tool-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition);
}

.home-tool-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.home-tool-emoji {
    font-size: 32px;
}

.home-tool-name {
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

@media (max-width: 600px) {
    .home-tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .home-tool-card {
        padding: 16px 12px;
    }
    
    .home-tool-emoji {
        font-size: 28px;
    }
}

/* === Related Tools === */
.related-tools {
    margin-top: 48px;
}

.related-tools h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.related-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition);
}

.related-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.related-emoji {
    font-size: 20px;
}

.related-name {
    font-size: 13px;
    font-weight: 500;
}

/* === FAQ === */
.faq {
    margin-top: 48px;
}

.faq h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.faq-item summary {
    padding: 16px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background var(--transition);
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 18px;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-item summary:hover {
    background: var(--bg-tertiary);
}

.faq-item p {
    padding: 0 20px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

@media (max-width: 600px) {
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .related-card {
        padding: 12px;
    }
    
    .related-name {
        font-size: 12px;
    }
}

/* === Legal Pages === */
.legal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
}

.legal-content section {
    margin-bottom: 32px;
}

.legal-content section:last-of-type {
    margin-bottom: 16px;
}

.legal-content h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.legal-content p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
}

.legal-content ul {
    margin: 12px 0;
    padding-left: 24px;
}

.legal-content li {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 6px;
}

.legal-content a {
    color: var(--accent);
    text-decoration: none;
}

.legal-content a:hover {
    text-decoration: underline;
}

.legal-date {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* === Cookie Banner === */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1e1e1e;
    color: white;
    padding: 16px 24px;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}

.cookie-banner.show {
    transform: translateY(0);
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.cookie-content p {
    font-size: 14px;
    margin: 0;
    flex: 1;
    min-width: 200px;
}

.cookie-buttons {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cookie-btn {
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.cookie-accept {
    background: white;
    color: #1e1e1e;
}

.cookie-accept:hover {
    background: #f0f0f0;
}

.cookie-link {
    color: #888;
    font-size: 13px;
    text-decoration: none;
}

.cookie-link:hover {
    color: white;
    text-decoration: underline;
}

@media (max-width: 600px) {
    .cookie-content {
        flex-direction: column;
        text-align: center;
    }
    
    .cookie-content p {
        font-size: 13px;
    }
    
    .cookie-buttons {
        width: 100%;
        justify-content: center;
    }
}

