/* 
 * anki-converter — CSS Styles
 * E-Ink optimised Anki deck to EPUB converter
 */

/* CSS Variables */
:root {
    --color-bg: #0f0f1a;
    --color-surface: #1a1a2e;
    --color-surface-hover: #252542;
    --color-primary: #6366f1;
    --color-primary-hover: #4f46e5;
    --color-secondary: #64748b;
    --color-success: #22c55e;
    --color-success-hover: #16a34a;
    --color-text: #f8fafc;
    --color-text-muted: #94a3b8;
    --color-border: #334155;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    --color-drop: #6366f140;
    --color-drop-border: #6366f1;
    
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

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

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.app-header {
    padding: 3rem 0 2rem;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 2.5rem;
}

.app-title {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-primary), #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.app-subtitle {
    color: var(--color-text-muted);
    font-size: 1.1rem;
}

/* Main Content */
.app-main {
    padding: 0 0 4rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Controls Panel */
.controls {
    background-color: var(--color-surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Tab Bar */
.tab-bar {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1rem;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background-color: var(--color-bg);
}

.drop-zone.drag-over {
    border-color: var(--color-drop-border);
    background-color: var(--color-drop);
    transform: scale(1.01);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.drop-icon {
    font-size: 3rem;
    line-height: 1;
}

.drop-label {
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

/* URL Input */
.url-input-section {
    padding: 0.5rem 0;
}

.url-row {
    display: flex;
    gap: 0.75rem;
}

.url-row .form-input {
    flex: 1;
}

/* Settings Section */
.settings-section {
    background-color: var(--color-surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border);
    padding: 1.5rem;
}

/* Form Elements */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input,
.form-select {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-sans);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

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

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

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

.btn-secondary:hover:not(:disabled) {
    background-color: var(--color-surface-hover);
}

.btn-success {
    background-color: var(--color-success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: var(--color-success-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.btn-tab {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
}

.btn-tab:hover {
    color: var(--color-text);
    background: var(--color-surface-hover);
}

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

/* Convert Section */
.convert-section {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
}

.btn-convert {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--color-primary), #a855f7);
}

.btn-convert:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

/* Status / Error Messages */
.status-msg {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    padding: 0.5rem;
}

.error-msg {
    text-align: center;
    color: var(--color-error);
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
}

/* Result Panel */
.result-panel {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(99, 102, 241, 0.08));
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-xl);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    text-align: center;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.result-icon {
    font-size: 2rem;
}

.result-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.result-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.stat-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    min-width: 100px;
}

.stat-badge-ok {
    border-color: rgba(34, 197, 94, 0.4);
    background-color: rgba(34, 197, 94, 0.08);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
}

.btn-download {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 360px;
}

/* Footer */
.app-footer {
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-credit {
    font-size: 0.8rem;
    opacity: 0.6;
}

/* Error Container */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    text-align: center;
}

.error-container h1 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--color-error);
}

.error-details {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--color-surface);
    border-radius: var(--radius-md);
}

/* Responsive */
@media (max-width: 640px) {
    .app-title {
        font-size: 2.25rem;
    }
    
    .controls {
        padding: 1.25rem;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }

    .url-row {
        flex-direction: column;
    }

    .result-stats {
        gap: 0.75rem;
    }

    .btn {
        width: 100%;
    }

    .tab-bar {
        width: 100%;
    }

    .tab-bar .btn {
        flex: 1;
    }
}
