/* ============================================
   Demo Mailing List - Modern Pure CSS Theme
   Mobile friendly, Dark/Light mode (defaults to light)
   No external libraries
   ============================================ */

:root {
    /* Light mode (default) */
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --accent: #0ea5e9;
    --accent-hover: #0284c8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #ca8a04;
    --logo-surface: #efefef;
    --radius: 14px;
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text);
}

.dark {
    /* Dark mode */
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --success: #4ade80;
    --danger: #f87171;
    --warning: #fbbf24;
    --logo-surface: #efefef;
    --radius: 14px;
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

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

body {
    background: var(--bg);
    margin: 0;
    padding: 0;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.logo {
    flex-shrink: 0;
    background: var(--logo-surface);
    width: 120px;
    height: 120px;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s ease;
}

.logo:hover {
    transform: scale(1.02);
}

.logo svg {
    display: block;
    width: 100%;
    height: 100%;
}

.header-text h1 {
    margin: 0;
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text);
}

.header-text .tagline {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 400;
}

/* Theme Toggle */
.theme-toggle {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    width: 48px;
    height: 48px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.theme-toggle:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-1px);
}

.dark .icon-light { display: none; }
.dark .icon-dark { display: inline; }
.icon-dark { display: none; }

/* Explanation block */
.explanation {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.explanation p {
    margin: 0 0 0.65rem;
    color: var(--text-muted);
    font-size: 0.975rem;
}

.explanation p:last-child {
    margin-bottom: 0;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.25rem;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    transition: all 0.15s ease;
}

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

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease forwards;
}

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

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card h2 {
    margin: 0 0 0.35rem;
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text);
}

.card-subtitle {
    color: var(--text-muted);
    margin: 0 0 1.5rem;
    font-size: 1rem;
}

/* Forms */
.form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-weight: 600;
    font-size: 0.925rem;
    color: var(--text);
}

.form-group input {
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.12);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgb(14 165 233 / 0.3);
}

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

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

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

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

.btn-block {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.05rem;
}

.form-note {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.75rem;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.975rem;
    border: 1px solid transparent;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.dark .alert-success {
    background: #14532d;
    color: #4ade80;
    border-color: #166534;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.dark .alert-error {
    background: #7f1d1d;
    color: #f87171;
    border-color: #991b1b;
}

.alert-info {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
}

.dark .alert-info {
    background: #0c4a6e;
    color: #7dd3fc;
    border-color: #0369a1;
}

/* Footer */
.footer {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

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

.footer a:hover {
    text-decoration: underline;
}

.footer .small {
    font-size: 0.8rem;
    margin-top: 0.35rem;
    opacity: 0.7;
}

/* Admin specific */
.admin-nav a {
    transition: all 0.1s ease;
}

.admin-nav a:hover:not(.active) {
    background: var(--border);
}

/* Tables */
table {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

th {
    background: var(--bg);
    color: var(--text-muted);
}

tr:hover td {
    background: var(--bg);
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1.25rem 1rem;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .logo {
        width: 92px;
        height: 92px;
    }
    
    .header-text h1 {
        font-size: 1.65rem;
    }
    
    .tabs {
        flex-direction: column;
        border-bottom: none;
    }
    
    .tab-btn {
        border-bottom: 1px solid var(--border);
        text-align: left;
        padding-left: 0;
    }
    
    .tab-btn.active {
        border-bottom-color: var(--accent);
    }
    
    .card {
        padding: 1.5rem;
    }
}

/* Accessibility */
button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .theme-toggle, .btn, .tabs, .admin-nav { display: none !important; }
    .card { box-shadow: none; border: 1px solid #ccc; }
}
