/* ==========================================================================
   Slide Deck Creator -- Design System
   Version: 1.0
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Font Imports (Google Fonts via CDN)
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@400;500;600;700&display=swap');

/* --------------------------------------------------------------------------
   1. CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
    /* Ink / Text */
    --ink: #0f172a;
    --ink-soft: #475569;
    --ink-muted: #94a3b8;
    --ink-inverse: #ffffff;

    /* Paper / Background */
    --paper: #faf8f5;
    --paper-deep: #f1ede8;
    --paper-card: #ffffff;
    --paper-elevated: #ffffff;

    /* Accent */
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-soft: rgba(99, 102, 241, 0.1);
    --accent-border: rgba(99, 102, 241, 0.3);

    /* Semantic */
    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.1);
    --success-border: rgba(34, 197, 94, 0.3);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.1);
    --warning-border: rgba(245, 158, 11, 0.3);
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.1);
    --danger-border: rgba(239, 68, 68, 0.3);
    --info: #3b82f6;
    --info-soft: rgba(59, 130, 246, 0.1);
    --info-border: rgba(59, 130, 246, 0.3);

    /* Borders */
    --border: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.15);

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 32px 64px rgba(0, 0, 0, 0.16);

    /* Radii */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Typography */
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;
    --font-mono: 'SF Mono', 'Fira Code', monospace;

    /* Font sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: 2.5rem;

    /* Spacing scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --container-max: 1200px;
    --container-narrow: 640px;
}

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

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

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--ink);
    background-color: var(--paper);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

img,
svg {
    display: block;
    max-width: 100%;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

ul, ol {
    list-style: none;
}

button {
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    border: none;
    background: none;
}

input,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
}

table {
    border-collapse: collapse;
    width: 100%;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
.text-display {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }

.text-muted { color: var(--ink-soft); }
.text-light { color: var(--ink-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-narrow {
    max-width: var(--container-narrow);
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-content {
    flex: 1;
    padding: var(--space-8) 0;
}

/* Grid */
.grid {
    display: grid;
    gap: var(--space-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .grid-2,
    .grid-3,
    .grid-4 { grid-template-columns: 1fr; }
}

/* Flex utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Spacing utilities */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

/* --------------------------------------------------------------------------
   5. Top Navigation Bar
   -------------------------------------------------------------------------- */
.topbar {
    height: var(--topbar-height);
    background: var(--paper-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.9);
}

.topbar-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-6);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-weight: 700;
    font-size: var(--text-lg);
    color: var(--ink);
    text-decoration: none;
}

.topbar-brand svg,
.topbar-brand img {
    width: 32px;
    height: 32px;
}

.topbar-brand:hover {
    color: var(--ink);
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.topbar-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.topbar-nav a:hover {
    color: var(--ink);
    background: var(--paper-deep);
}

.topbar-nav a.active {
    color: var(--accent);
    background: var(--accent-soft);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2) var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    background: var(--paper-deep);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    border: none;
}

.topbar-user:hover {
    background: var(--border-strong);
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-sm);
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: var(--space-2);
    cursor: pointer;
    background: none;
    border: none;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
    transition: all var(--transition-base);
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .topbar-nav {
        display: none;
        position: absolute;
        top: var(--topbar-height);
        left: 0;
        right: 0;
        background: var(--paper-card);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: var(--space-4);
        box-shadow: var(--shadow-md);
    }

    .topbar-nav.open {
        display: flex;
    }

    .topbar-nav a {
        width: 100%;
        padding: var(--space-3) var(--space-4);
    }

    .topbar-actions .topbar-user span:not(.topbar-avatar) {
        display: none;
    }
}

/* --------------------------------------------------------------------------
   6. Admin Sidebar
   -------------------------------------------------------------------------- */
.admin-layout {
    display: flex;
    min-height: calc(100vh - var(--topbar-height));
}

.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--paper-card);
    border-right: 1px solid var(--border);
    padding: var(--space-6) 0;
    position: sticky;
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-section {
    padding: 0 var(--space-4);
    margin-bottom: var(--space-6);
}

.sidebar-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-muted);
    padding: 0 var(--space-3);
    margin-bottom: var(--space-2);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.sidebar-nav a:hover {
    color: var(--ink);
    background: var(--paper-deep);
}

.sidebar-nav a.active {
    color: var(--accent);
    background: var(--accent-soft);
    font-weight: 600;
}

.sidebar-nav a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.admin-content {
    flex: 1;
    padding: var(--space-8);
    min-width: 0;
}

@media (max-width: 1024px) {
    .admin-sidebar {
        display: none;
    }

    .admin-sidebar.open {
        display: block;
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        z-index: 90;
        box-shadow: var(--shadow-lg);
    }

    .admin-content {
        padding: var(--space-4);
    }
}

/* --------------------------------------------------------------------------
   7. Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: var(--text-sm);
    line-height: 1.4;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
}

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

.btn svg {
    width: 16px;
    height: 16px;
}

/* Primary */
.btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Secondary */
.btn-secondary {
    background: var(--paper-deep);
    color: var(--ink);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background: var(--border-strong);
}

/* Danger */
.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--ink-soft);
}

.btn-ghost:hover {
    background: var(--paper-deep);
    color: var(--ink);
}

/* Success */
.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-success:hover {
    background: #16a34a;
    color: white;
}

/* Sizes */
.btn-sm {
    padding: 6px 12px;
    font-size: var(--text-xs);
}

.btn-lg {
    padding: 14px 28px;
    font-size: var(--text-base);
    border-radius: var(--radius-md);
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
}

.btn-icon.btn-sm {
    width: 28px;
    height: 28px;
    padding: 4px;
}

/* Full width */
.btn-block {
    width: 100%;
}

/* Loading state */
.btn.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: var(--space-2);
}

/* --------------------------------------------------------------------------
   8. Form Elements
   -------------------------------------------------------------------------- */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--ink);
    margin-bottom: var(--space-2);
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--ink-muted);
    margin-top: var(--space-1);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--paper-card);
    color: var(--ink);
    font-size: var(--text-sm);
    transition: all var(--transition-fast);
    line-height: 1.5;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--ink-muted);
}

.form-input.error,
.form-textarea.error,
.form-select.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-soft);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--danger);
    margin-top: var(--space-1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

/* Checkbox */
.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--text-sm);
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-strong);
    accent-color: var(--accent);
    cursor: pointer;
}

/* Toggle Switch */
.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    user-select: none;
}

.toggle-switch input {
    display: none;
}

.toggle-track {
    width: 44px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--border-strong);
    position: relative;
    transition: background var(--transition-fast);
    flex-shrink: 0;
}

.toggle-track::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-xs);
}

.toggle-switch input:checked + .toggle-track {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-track::after {
    transform: translateX(20px);
}

.toggle-label {
    font-size: var(--text-sm);
    color: var(--ink-soft);
}

/* Inline form row */
.form-row {
    display: flex;
    gap: var(--space-4);
}

.form-row .form-group {
    flex: 1;
}

@media (max-width: 640px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* --------------------------------------------------------------------------
   9. Cards
   -------------------------------------------------------------------------- */
.card {
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: box-shadow var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: var(--text-base);
    font-weight: 600;
}

.card-body {
    padding: var(--space-6);
}

.card-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
    background: var(--paper);
}

/* Stat card */
.stat-card {
    padding: var(--space-6);
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
}

.stat-card-icon svg {
    width: 22px;
    height: 22px;
}

.stat-card-icon.accent {
    background: var(--accent-soft);
    color: var(--accent);
}

.stat-card-icon.success {
    background: var(--success-soft);
    color: var(--success);
}

.stat-card-icon.warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.stat-card-icon.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.stat-card-icon.info {
    background: var(--info-soft);
    color: var(--info);
}

.stat-card-value {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
    margin-bottom: var(--space-1);
}

.stat-card-label {
    font-size: var(--text-sm);
    color: var(--ink-soft);
}

/* --------------------------------------------------------------------------
   10. Tables
   -------------------------------------------------------------------------- */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--paper-card);
}

.table {
    width: 100%;
    font-size: var(--text-sm);
}

.table thead {
    background: var(--paper);
    border-bottom: 1px solid var(--border);
}

.table th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-weight: 600;
    color: var(--ink-soft);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    color: var(--ink);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--paper);
}

.table-actions {
    display: flex;
    gap: var(--space-1);
}

/* --------------------------------------------------------------------------
   11. Alerts / Flash Messages
   -------------------------------------------------------------------------- */
.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    border: 1px solid transparent;
    position: relative;
}

.alert svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-close {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
    padding: var(--space-1);
    border-radius: var(--radius-xs);
    transition: opacity var(--transition-fast);
}

.alert-close:hover {
    opacity: 1;
}

.alert-success {
    background: var(--success-soft);
    border-color: var(--success-border);
    color: #166534;
}

.alert-error {
    background: var(--danger-soft);
    border-color: var(--danger-border);
    color: #991b1b;
}

.alert-warning {
    background: var(--warning-soft);
    border-color: var(--warning-border);
    color: #92400e;
}

.alert-info {
    background: var(--info-soft);
    border-color: var(--info-border);
    color: #1e40af;
}

/* Flash messages container */
.flash-messages {
    position: fixed;
    top: calc(var(--topbar-height) + var(--space-4));
    right: var(--space-4);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-width: 420px;
    width: 100%;
}

.flash-messages .alert {
    box-shadow: var(--shadow-md);
    animation: slideInRight 0.3s ease-out;
}

.flash-messages .alert.dismissing {
    animation: slideOutRight 0.3s ease-in forwards;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* --------------------------------------------------------------------------
   12. Badges
   -------------------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}

.badge-default {
    background: var(--paper-deep);
    color: var(--ink-soft);
}

.badge-accent {
    background: var(--accent-soft);
    color: var(--accent);
}

.badge-success {
    background: var(--success-soft);
    color: #166534;
}

.badge-warning {
    background: var(--warning-soft);
    color: #92400e;
}

.badge-danger {
    background: var(--danger-soft);
    color: #991b1b;
}

.badge-info {
    background: var(--info-soft);
    color: #1e40af;
}

/* --------------------------------------------------------------------------
   13. Pagination
   -------------------------------------------------------------------------- */
.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    justify-content: center;
    padding: var(--space-4) 0;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--ink-soft);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.pagination a:hover {
    background: var(--paper-deep);
    color: var(--ink);
}

.pagination .active {
    background: var(--accent);
    color: white;
}

.pagination .disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   14. Modal
   -------------------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--paper-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 540px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-base);
}

.modal-overlay.open .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: var(--space-6) var(--space-6) 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: var(--text-lg);
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--ink-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--paper-deep);
    color: var(--ink);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: 0 var(--space-6) var(--space-6);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* --------------------------------------------------------------------------
   15. Dropdown
   -------------------------------------------------------------------------- */
.dropdown {
    position: relative;
    display: inline-flex;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-1);
    min-width: 180px;
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--transition-fast);
    padding: var(--space-1);
}

.dropdown.open .dropdown-menu,
.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-xs);
    font-size: var(--text-sm);
    color: var(--ink);
    cursor: pointer;
    transition: background var(--transition-fast);
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    text-decoration: none;
}

.dropdown-item:hover {
    background: var(--paper-deep);
    color: var(--ink);
}

.dropdown-item.danger {
    color: var(--danger);
}

.dropdown-item.danger:hover {
    background: var(--danger-soft);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-1) 0;
}

/* --------------------------------------------------------------------------
   16. Spinner / Loading
   -------------------------------------------------------------------------- */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 10;
}

/* --------------------------------------------------------------------------
   17. Auth Layout (centered card)
   -------------------------------------------------------------------------- */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--paper);
    padding: var(--space-4);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-10);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--ink);
}

.auth-logo svg {
    width: 40px;
    height: 40px;
    color: var(--accent);
}

.auth-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--space-2);
}

.auth-subtitle {
    font-size: var(--text-sm);
    color: var(--ink-soft);
    text-align: center;
    margin-bottom: var(--space-8);
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-6);
    font-size: var(--text-sm);
    color: var(--ink-soft);
}

.auth-footer a {
    font-weight: 500;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin: var(--space-6) 0;
    color: var(--ink-muted);
    font-size: var(--text-xs);
}

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

/* --------------------------------------------------------------------------
   18. Page Headers
   -------------------------------------------------------------------------- */
.page-header {
    margin-bottom: var(--space-8);
}

.page-header h1 {
    font-size: var(--text-2xl);
    font-weight: 700;
    margin-bottom: var(--space-1);
}

.page-header p {
    color: var(--ink-soft);
    font-size: var(--text-sm);
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* --------------------------------------------------------------------------
   19. Empty States
   -------------------------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-8);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--ink-muted);
    margin: 0 auto var(--space-6);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
}

.empty-state p {
    color: var(--ink-soft);
    font-size: var(--text-sm);
    margin-bottom: var(--space-6);
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

/* --------------------------------------------------------------------------
   20. Utility Classes
   -------------------------------------------------------------------------- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

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

.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.relative { position: relative; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.w-full { width: 100%; }

.border-bottom { border-bottom: 1px solid var(--border); }
.border-top { border-top: 1px solid var(--border); }

/* Confirm dialog styling */
.confirm-dialog .modal {
    max-width: 400px;
}

.confirm-dialog .modal-body {
    text-align: center;
}

.confirm-dialog .modal-body svg {
    width: 48px;
    height: 48px;
    color: var(--warning);
    margin: 0 auto var(--space-4);
}

/* --------------------------------------------------------------------------
   21. Responsive Helpers
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
    :root {
        --text-3xl: 1.75rem;
        --text-4xl: 2rem;
    }

    .auth-card {
        padding: var(--space-6);
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: var(--space-4);
    }
}

/* --------------------------------------------------------------------------
   22. Dashboard specific
   -------------------------------------------------------------------------- */
.welcome-header {
    padding: var(--space-8);
    background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
    border-radius: var(--radius-lg);
    color: white;
    margin-bottom: var(--space-8);
}

.welcome-header h1 {
    font-size: var(--text-3xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.welcome-header p {
    opacity: 0.85;
    font-size: var(--text-base);
}

.deck-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--paper-card);
    overflow: hidden;
    transition: all var(--transition-base);
    cursor: pointer;
}

.deck-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.deck-card-thumb {
    aspect-ratio: 16/9;
    background: var(--paper-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-muted);
    font-size: var(--text-3xl);
    border-bottom: 1px solid var(--border);
}

.deck-card-body {
    padding: var(--space-4);
}

.deck-card-title {
    font-weight: 600;
    font-size: var(--text-sm);
    margin-bottom: var(--space-1);
}

.deck-card-meta {
    font-size: var(--text-xs);
    color: var(--ink-muted);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* --------------------------------------------------------------------------
   23. Search & Filter Bar
   -------------------------------------------------------------------------- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.search-input {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-input input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--paper-card);
    font-size: var(--text-sm);
    transition: all var(--transition-fast);
}

.search-input input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-input svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--ink-muted);
}

/* --------------------------------------------------------------------------
   24. Deck Card Extensions
   -------------------------------------------------------------------------- */
.deck-card-wrapper {
    position: relative;
}

.deck-card-wrapper .deck-card-actions {
    position: absolute;
    bottom: var(--space-3);
    right: var(--space-3);
    display: flex;
    gap: var(--space-1);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.deck-card-wrapper:hover .deck-card-actions {
    opacity: 1;
}

.deck-card-date {
    margin-top: var(--space-2);
}

.deck-card-thumb {
    position: relative;
}

.deck-status-badge {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.deck-status-badge.badge-success {
    background: var(--success-soft);
    color: var(--success);
}

.deck-status-badge.badge-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.deck-status-badge.badge-secondary {
    background: var(--paper-deep);
    color: var(--ink-muted);
}

.deck-type-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--radius-xs);
    background: var(--accent-soft);
    color: var(--accent);
}

.brand-color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   25. Print
   -------------------------------------------------------------------------- */
@media print {
    .topbar,
    .admin-sidebar,
    .flash-messages,
    .btn,
    .pagination {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
