/* ============================================================================
   Pricer Flash Demo - Stylesheet
   ============================================================================
   - Light/dark mode via [data-theme] attribuut
   - CSS custom properties voor eenvoudige rebranding
   - Mobiel-vriendelijk responsive layout
   - Toegankelijkheid: focus rings, skip-link, voldoende contrast
   ============================================================================ */

:root {
    /* Brand colors - kunnen per company overruled worden in Phase 2 */
    --primary:        #2563eb;
    --primary-dark:   #1e40af;
    --primary-light:  #dbeafe;
    --accent:         #10b981;

    /* Grays */
    --gray-50:  #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Status colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error:   #ef4444;
    --info:    #3b82f6;

    /* Semantic colors (light theme default) */
    --bg:           var(--gray-50);
    --surface:      #ffffff;
    --surface-alt:  var(--gray-100);
    --text:         var(--gray-900);
    --text-muted:   var(--gray-500);
    --border:       var(--gray-200);
    --border-strong:var(--gray-300);

    /* Spacing & shadows */
    --radius-sm: 4px;
    --radius:    8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow:    0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
}

[data-theme="dark"] {
    --bg:           var(--gray-900);
    --surface:      var(--gray-800);
    --surface-alt:  var(--gray-700);
    --text:         var(--gray-100);
    --text-muted:   var(--gray-400);
    --border:       var(--gray-700);
    --border-strong:var(--gray-600);
    --primary-light: rgba(59, 130, 246, 0.15);
}

/* ============================================================================
   Reset & base
   ============================================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 { margin: 0 0 0.75rem; line-height: 1.3; font-weight: 600; color: var(--text); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
    background: var(--surface-alt);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.875em;
}

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

/* Skip link voor toegankelijkheid */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    z-index: 1000;
}
.skip-link:focus { left: 0; }

/* Focus ring voor alle interactieve elementen */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ============================================================================
   Auth pages (login, 2FA)
   ============================================================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--primary-light) 100%);
    padding: 1rem;
}

[data-theme="dark"] .auth-page {
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
}

.auth-container { width: 100%; max-width: 420px; }

.auth-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.auth-header h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.auth-subtitle { color: var(--text-muted); font-size: 0.9375rem; margin: 0; }
.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}

/* TOTP input - groter en gespaceerd */
.totp-input {
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 1.5rem;
    letter-spacing: 0.5em;
    text-align: center;
    font-weight: 600;
}

/* ============================================================================
   Admin layout
   ============================================================================ */

.admin-page { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }

.admin-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.admin-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    max-width: 100%;
}
.admin-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-weight: 600;
    color: var(--text);
    font-size: 1.0625rem;
}
.admin-brand:hover { text-decoration: none; }
.admin-brand svg { color: var(--primary); }

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

.btn-icon {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
    font-size: 1.1rem;
}
.btn-icon:hover { background: var(--surface-alt); }

.theme-toggle .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-light { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-dark  { display: inline; }

.user-menu { position: relative; }
.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid var(--border);
    padding: 0.375rem 0.75rem 0.375rem 0.375rem;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9375rem;
}
.user-menu-btn:hover { background: var(--surface-alt); }
.user-avatar {
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8125rem;
}
.user-name { font-weight: 500; }
.user-role { color: var(--text-muted); font-size: 0.8125rem; }

.user-menu-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    min-width: 180px;
    overflow: hidden;
}
.user-menu-dropdown a {
    display: block;
    padding: 0.625rem 1rem;
    color: var(--text);
    font-size: 0.9375rem;
}
.user-menu-dropdown a:hover {
    background: var(--surface-alt);
    text-decoration: none;
}

.admin-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    flex: 1;
}
.admin-sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1rem 0;
    min-height: calc(100vh - 60px);
}
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    color: var(--text);
    font-size: 0.9375rem;
    border-left: 3px solid transparent;
    transition: background 0.15s;
}
.nav-item:hover {
    background: var(--surface-alt);
    text-decoration: none;
}
.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}
.nav-icon { font-size: 1.125rem; flex-shrink: 0; }

.admin-main {
    padding: 1.5rem 2rem 3rem;
    max-width: 100%;
    overflow-x: auto;
}

.admin-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 0.875rem 1.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.admin-footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ============================================================================
   Page header
   ============================================================================ */

.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin-bottom: 0.25rem; }
.page-header p { margin: 0; }

/* ============================================================================
   Cards
   ============================================================================ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header h2 { margin: 0; font-size: 1rem; }
.card-body { padding: 1.25rem; }

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* ============================================================================
   Stats grid
   ============================================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}
.stat-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.stat-info { flex: 1; min-width: 0; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; color: var(--text); }
.stat-label { color: var(--text-muted); font-size: 0.8125rem; }

/* ============================================================================
   Lists (data list, event list, next-steps)
   ============================================================================ */

.data-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.5rem 1.5rem;
    margin: 0;
}
.data-list dt { color: var(--text-muted); font-weight: 500; }
.data-list dd { margin: 0; color: var(--text); font-weight: 500; }

.event-list { list-style: none; padding: 0; margin: 0; }
.event-list li {
    display: grid;
    grid-template-columns: 90px 1fr 100px;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}
.event-list li:last-child { border-bottom: none; }
.event-time { color: var(--text-muted); font-family: "SF Mono", Menlo, Consolas, monospace; }
.event-type { font-weight: 500; }
.event-user { color: var(--text-muted); text-align: right; }

.next-steps {
    margin: 0;
    padding-left: 1.25rem;
}
.next-steps li {
    margin-bottom: 0.625rem;
    line-height: 1.6;
}

/* ============================================================================
   Forms
   ============================================================================ */

.form-group { margin-bottom: 1rem; }

label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    color: var(--text);
    font-size: 0.9375rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn:hover { text-decoration: none; }

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

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-alt); }

.btn-danger {
    background: var(--error);
    color: white;
    border-color: var(--error);
}
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }

.btn-block { width: 100%; }

/* ============================================================================
   Alerts
   ============================================================================ */

.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid transparent;
    font-size: 0.9375rem;
}
.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}
.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}
.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}
.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

[data-theme="dark"] .alert-error   { background: rgba(239, 68, 68, 0.1);  color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); }
[data-theme="dark"] .alert-success { background: rgba(16, 185, 129, 0.1); color: #86efac; border-color: rgba(16, 185, 129, 0.3); }
[data-theme="dark"] .alert-warning { background: rgba(245, 158, 11, 0.1); color: #fcd34d; border-color: rgba(245, 158, 11, 0.3); }
[data-theme="dark"] .alert-info    { background: rgba(59, 130, 246, 0.1); color: #93c5fd; border-color: rgba(59, 130, 246, 0.3); }

/* ============================================================================
   Badges
   ============================================================================ */

.badge {
    display: inline-block;
    padding: 0.1875rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-error   { background: #fee2e2; color: #991b1b; }
.badge-info    { background: var(--primary-light); color: var(--primary-dark); }

[data-theme="dark"] .badge-success { background: rgba(16, 185, 129, 0.2);  color: #86efac; }
[data-theme="dark"] .badge-warning { background: rgba(245, 158, 11, 0.2);  color: #fcd34d; }
[data-theme="dark"] .badge-error   { background: rgba(239, 68, 68, 0.2);   color: #fca5a5; }
[data-theme="dark"] .badge-info    { background: rgba(59, 130, 246, 0.2);  color: #93c5fd; }

/* ============================================================================
   Responsive: collapse sidebar op mobiel
   ============================================================================ */

@media (max-width: 768px) {
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar {
        position: fixed;
        left: -100%;
        top: 60px;
        width: 240px;
        height: calc(100vh - 60px);
        z-index: 99;
        transition: left 0.2s;
    }
    .admin-sidebar.open { left: 0; }
    .admin-main { padding: 1rem; }
    .admin-header-inner { padding: 0.625rem 1rem; }
    .user-name, .user-role { display: none; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    h1 { font-size: 1.375rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .event-list li { grid-template-columns: 1fr; gap: 0.25rem; }
    .event-user { text-align: left; }
}
