/* ============================================
   CSS Variables & Base
   ============================================ */

:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-card: #222222;
    --bg-hover: #2a2a2a;
    
    --accent: #f59e0b;
    --accent-hover: #fbbf24;
    --accent-dim: rgba(245, 158, 11, 0.1);
    
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    --border: #2e2e2e;
    --border-accent: var(--accent);
    
    --success: #22c55e;
    --error: #ef4444;
    --info: #3b82f6;
    
    --radius: 8px;
    --radius-lg: 12px;
    
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'IBM Plex Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

*, *::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-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Layout
   ============================================ */

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
}

.main {
    flex: 1;
}

/* ============================================
   Header
   ============================================ */

.header {
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-icon {
    color: var(--accent);
    font-size: 1.25rem;
}

.logo-text {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
}

.nav {
    display: flex;
    gap: 24px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
}

/* ============================================
   Hero Section
   ============================================ */

.hero {
    padding: 80px 0 60px;
    text-align: center;
}

.hero-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.hero-title .accent {
    color: var(--accent);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
}

/* ============================================
   Tools Grid
   ============================================ */

.tools {
    padding: 40px 0;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================
   Tool Card
   ============================================ */

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 24px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.3s, transform 0.3s;
    display: block;
}

.tool-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
}

.tool-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
}

.tool-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.tool-name {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.tool-desc {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.tool-formats {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-family: var(--font-mono);
    margin-bottom: 24px;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

/* ============================================
   Converter Section
   ============================================ */

.tool-header {
    padding: 48px 0 32px;
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 16px;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--text-primary);
}

.page-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-desc {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.converter {
    padding: 24px 0;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg-secondary);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.upload-icon {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.upload-text {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: inherit;
    text-decoration: underline;
}

.upload-formats {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: var(--font-mono);
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 32px 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* URL Input */
.url-input-group {
    display: flex;
    gap: 12px;
}

.input {
    flex: 1;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.input:focus {
    border-color: var(--accent);
}

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

/* ============================================
   Result Section
   ============================================ */

.result-section {
    padding: 32px 0;
    animation: fadeIn 0.3s ease;
}

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

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.result-header h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
}

.result-actions {
    display: flex;
    gap: 8px;
}

.result-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-height: 500px;
    overflow: auto;
}

.result-content pre {
    margin: 0;
}

.result-content code {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ============================================
   Formats Section
   ============================================ */

.formats {
    padding: 48px 0;
    border-top: 1px solid var(--border);
    margin-top: 48px;
}

.formats-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: center;
}

.formats-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.format-tag {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 20px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ============================================
   Coming Soon
   ============================================ */

.coming-soon {
    padding: 40px 0;
    text-align: center;
}

.coming-soon-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============================================
   Footer
   ============================================ */

.footer {
    padding: 32px 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ============================================
   Loading State
   ============================================ */

.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--bg-primary);
    opacity: 0.5;
}

/* ============================================
   Toast Notification
   ============================================ */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--error);
}

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

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 640px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .tool-card {
        padding: 32px 24px;
    }
    
    .url-input-group {
        flex-direction: column;
    }
    
    .result-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}