/* ==========================================
   MikroTik Backup Generator - Notion Style
   Flat, Bold, Minimalist Design
   ========================================== */

:root {
    /* Notion-inspired Colors */
    --primary: #2563eb;
    /* Bold blue */
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    /* Green */
    --warning: #ea580c;
    /* Orange */
    --error: #dc2626;
    /* Red */

    /* Backgrounds */
    --bg-page: #ffffff;
    --bg-card: #f8f9fa;
    --bg-hover: #e9ecef;
    --bg-input: #ffffff;

    /* Text */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;

    /* Borders */
    --border: #e5e7eb;
    --border-dark: #d1d5db;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;

    /* Border Radius - Flat, minimal */
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;

    /* Info boxes - Light theme */
    --info-bg: #eff6ff;
    --info-border: #bfdbfe;
    --warning-bg: #fff7ed;
    --warning-border: #fed7aa;
}

[data-theme="dark"] {
    --bg-page: #191919;
    --bg-card: #1f1f1f;
    --bg-hover: #2a2a2a;
    --bg-input: #2d2d2d;

    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-tertiary: #6b7280;

    --border: #333333;
    --border-dark: #404040;

    /* Info boxes - Dark mode */
    --info-bg: rgba(37, 99, 235, 0.15);
    --info-border: rgba(37, 99, 235, 0.3);
    --warning-bg: rgba(234, 88, 12, 0.15);
    --warning-border: rgba(234, 88, 12, 0.3);

    /* Upload area - Dark mode */
    --upload-bg-hover: rgba(37, 99, 235, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--space-xl);
}

/* ==========================================
   Header - Notion Style
   ========================================== */

.header {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo .subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.header-stats {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-top: var(--space-xs);
}

.theme-toggle {
    padding: 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--border-dark);
}

.theme-toggle svg {
    display: block;
}

/* ==========================================
   Mode Toggle - Flat Pills
   ========================================== */

.mode-toggle {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

.mode-btn:hover {
    border-color: var(--border-dark);
    background: var(--bg-hover);
}

.mode-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.mode-btn svg {
    stroke-width: 2.5;
}

/* ==========================================
   Cards - Flat Notion Style
   ========================================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
}

.card-header {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--border);
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.card-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.card-actions {
    display: flex;
    gap: var(--space-sm);
}

/* ==========================================
   Forms - Clean & Minimal
   ========================================== */

.form-section {
    margin-bottom: var(--space-xl);
}

.form-section h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.form-group {
    margin-bottom: var(--space-md);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-md);
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

input[type="checkbox"] {
    width: auto;
    height: 1.25rem;
    margin-right: var(--space-sm);
    cursor: pointer;
    accent-color: var(--primary);
}

label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    font-weight: 500;
    cursor: pointer;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.15s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-page);
}

input::placeholder {
    color: var(--text-tertiary);
}

/* ==========================================
   Delivery Tabs - Bold Pills
   ========================================== */

.delivery-tabs {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.delivery-tab {
    flex: 1;
    min-width: 140px;
    padding: 0.75rem 1.25rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.delivery-tab:hover {
    border-color: var(--border-dark);
    background: var(--bg-hover);
}

.delivery-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ==========================================
   Info Boxes
   ========================================== */

.info-box {
    padding: var(--space-md);
    background: var(--info-bg);
    border: 2px solid var(--info-border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: var(--space-md);
    border-left: 4px solid var(--primary);
}

.info-box.warning {
    background: var(--warning-bg);
    border-color: var(--warning-border);
    border-left-color: var(--warning);
}

.info-box strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 700;
}

.info-box ol {
    margin-left: 1.25rem;
    color: var(--text-secondary);
}

.info-box code {
    background: rgba(0, 0, 0, 0.08);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', monospace;
    font-size: 0.8125rem;
    color: var(--primary);
    font-weight: 500;
}

.info-box a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.info-box a:hover {
    text-decoration: underline;
}

/* ==========================================
   Connection Status
   ========================================== */

.connection-status {
    display: inline-block;
    margin-left: var(--space-sm);
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.connection-status.testing {
    background: #fff7ed;
    color: var(--warning);
    border: 2px solid #fed7aa;
}

.connection-status.success {
    background: #f0fdf4;
    color: var(--success);
    border: 2px solid #bbf7d0;
}

.connection-status.error {
    background: #fef2f2;
    color: var(--error);
    border: 2px solid #fecaca;
}

.connection-status::before {
    content: '●';
    margin-right: 0.375rem;
}

/* ==========================================
   Buttons - Bold & Flat
   ========================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-dark);
}

.btn-large {
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
}

/* ==========================================
   Script Output - Terminal Style
   ========================================== */

pre {
    background: #1a1a1a;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-lg);
    overflow-x: auto;
    max-height: 600px;
}

code {
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: #22c55e;
}

/* ==========================================
   Upload Area
   ========================================== */

.upload-area {
    text-align: center;
    padding: var(--space-xl);
    border: 3px dashed var(--border-dark);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--upload-bg-hover, #eff6ff);
}

.upload-area svg {
    margin: 0 auto var(--space-md);
    stroke: var(--text-tertiary);
}

.upload-area h3 {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    font-weight: 700;
}

.upload-area p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.upload-area.drag-over {
    border-color: var(--primary);
    background: var(--upload-bg-hover, #dbeafe);
}

/* ==========================================
   CSV Table
   ========================================== */

.csv-preview h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
}

#csvTable {
    overflow-x: auto;
    margin-bottom: var(--space-md);
    background: var(--bg-input);
    border-radius: var(--radius);
    border: 2px solid var(--border);
}

#csvTable table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

#csvTable th,
#csvTable td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

#csvTable th {
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#csvTable tbody tr:hover {
    background: var(--bg-hover);
}

#csvTable tbody tr:last-child td {
    border-bottom: none;
}

/* ==========================================
   Utilities
   ========================================== */

.hidden {
    display: none !important;
}

.link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
}

.link:hover {
    text-decoration: underline;
}

.tooltip {
    position: relative;
    cursor: help;
    margin-left: var(--space-xs);
}

.form-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

/* ==========================================
   Toast - Minimal
   ========================================== */

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--text-primary);
    color: white;
    border-radius: var(--radius);
    transform: translateY(200%);
    transition: transform 0.2s ease;
    z-index: 1000;
    font-size: 0.875rem;
    font-weight: 600;
    border: 2px solid var(--text-primary);
}

.toast.show {
    transform: translateY(0);
}

/* ==========================================
   Footer
   ========================================== */

.footer {
    text-align: center;
    padding: var(--space-lg) 0;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    border-top: 2px solid var(--border);
    margin-top: var(--space-xl);
}

.footer .version {
    margin-top: var(--space-sm);
    font-size: 0.75rem;
}

/* ==========================================
   Responsive
   ========================================== */

@media (max-width: 768px) {
    .container {
        padding: var(--space-md);
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .mode-toggle {
        flex-direction: column;
        width: 100%;
    }

    .delivery-tabs {
        flex-direction: column;
    }

    .delivery-tab {
        width: 100%;
    }
}