/* Le-Conflict App Styles - Synced with Le-Behavior */

:root {
    --primary: #800080;
    --primary-dark: #6A1B9A;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f1f5f9;
    --bg-light: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.hidden { display: none !important; }

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
}

.logo { font-size: 1.5rem; }

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
    background: #f1f5f9;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-user-name {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.nav-user-name:hover {
    color: var(--primary);
}

/* Public Navbar */
.navbar-public {
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.navbar-public .nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-public .btn-outline {
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
}

.navbar-public .btn-outline:hover {
    background: var(--primary);
    color: white;
}

.nav-hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
    padding: 0.25rem 0.5rem;
}

.nav-mobile-menu {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0;
    background: white;
    border-top: 1px solid var(--border);
    padding: 0.5rem 0;
}

.nav-mobile-menu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s;
}

.nav-mobile-menu a:hover {
    background: #f1f5f9;
}

@media (max-width: 768px) {
    .navbar-public .nav-actions {
        display: none;
    }
    .navbar-public .nav-links {
        display: none;
    }
    .nav-hamburger {
        display: block;
    }
    .nav-mobile-menu:not(.hidden) {
        display: flex;
    }
}

.credits-badge {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: var(--secondary); opacity: 0.5; cursor: not-allowed; }

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

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: #f1f5f9; }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-link { background: none; color: var(--primary); padding: 0; }

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

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.stats-card {
    text-align: center;
}

.stats-card h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stats-card p {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Sections */
.section {
    margin-bottom: 2rem;
}

.section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* Test Cards */
.test-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.test-card {
    text-align: center;
}

.test-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.test-card h3 {
    margin-bottom: 0.5rem;
}

.test-card p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.test-meta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Results */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.result-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.result-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.result-meta {
    display: flex;
    flex-direction: column;
}

.result-type {
    font-weight: 600;
    font-size: 0.9rem;
}

.result-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.result-style {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

/* Teams */
.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.team-card {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.team-card h3 {
    margin-bottom: 0.5rem;
}

.team-card .team-meta {
    display: flex;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.join-card {
    max-width: 400px;
}

.inline-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    align-items: center;
}

.inline-form input,
.inline-form select {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
}

.data-table th, .data-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

td.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

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

.tab-btn {
    flex: 0 0 auto;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    border-radius: 0;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab-btn.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
    background: none;
    box-shadow: none;
}

.tab-content.hidden { display: none; }

/* Admin Tabs */
.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.admin-tabs .tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

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

.admin-tabs .tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.admin-tab-content.hidden {
    display: none;
}

/* Filters */
.filters {
    display: flex;
    gap: 0.5rem;
}

.filters select {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
}

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(128,0,128,0.1);
}

.auth-error, .form-error {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal h2 {
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Role Badges */
.role-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.role-badge.admin { background: #e74c3c; color: white; }
.role-badge.teamleider { background: #3498db; color: white; }
.role-badge.user { background: #95a5a6; color: white; }

/* Test type badges */
.test-badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 600;
    color: white;
    margin-left: 2px;
}
.test-conflict_basis { background: #800080; }
.test-conflict_respons { background: #6B8E23; }

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    padding: 2rem 1rem;
}

.auth-page-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
}

.auth-page-brand {
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.auth-page-card h2 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.auth-page-card .form-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.divider {
    text-align: center;
    margin: 1.25rem 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 1px solid var(--border);
}

.divider span {
    position: relative;
    background: white;
    padding: 0 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Welcome Banner */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 2rem;
}

.welcome-banner h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.welcome-banner p {
    opacity: 0.9;
}

/* Profile Page */
.profile-page h1 {
    margin-bottom: 1.5rem;
}

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.profile-card h3 {
    margin-bottom: 1.25rem;
    font-size: 1.1rem;
}

.input-readonly {
    background: #f1f5f9 !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.success-msg {
    color: var(--success);
    font-size: 0.875rem;
    font-weight: 500;
}

.error-msg {
    color: var(--danger);
    font-size: 0.875rem;
    font-weight: 500;
}

.profile-meta {
    margin-top: 0;
}

.profile-meta-grid {
    display: flex;
    gap: 3rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.meta-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

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

/* Score bars */
.scores-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.score-bar-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.score-bar-header {
    display: flex;
    justify-content: space-between;
}

.score-bar-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.score-bar-value {
    font-weight: 700;
}

.score-bar-track {
    height: 12px;
    background: #F1F5F9;
    border-radius: 6px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
}

/* Mini score bars in admin table */
.mini-scores {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 120px;
}

.mini-score-row {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 14px;
}

.mini-lbl {
    font-weight: 700;
    font-size: 0.7rem;
    width: 18px;
    text-align: center;
}

.mini-track {
    flex: 1;
    height: 8px;
    background: #F1F5F9;
    border-radius: 4px;
    overflow: hidden;
    min-width: 50px;
}

.mini-fill {
    height: 100%;
    border-radius: 4px;
    min-width: 2px;
}

.mini-val {
    font-size: 0.7rem;
    color: #64748B;
    width: 22px;
    text-align: right;
    font-weight: 600;
}

/* Enhanced score bars in modal */
.scores-visual {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 8px;
}

.score-bars-enhanced {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.score-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-bar-row .score-bar-label {
    font-weight: 600;
    font-size: 0.85rem;
    width: 100px;
    flex-shrink: 0;
}

.score-bar-row .score-bar-track {
    flex: 1;
    height: 20px;
    background: #F1F5F9;
    border-radius: 10px;
    overflow: hidden;
}

.score-bar-row .score-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s ease;
}

.score-bar-row .score-bar-value {
    font-weight: 700;
    font-size: 0.9rem;
    width: 50px;
    text-align: right;
}

/* Chart section in modal */
.chart-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #FAFAFA;
    border-radius: 12px;
    text-align: center;
}

.chart-section h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
}

/* Assessment detail modal */
.assessment-detail p {
    margin: 0.5rem 0;
}

/* Dashboard Charts */
.dashboard-charts-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-charts-grid .card h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
}

#type-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: #64748B;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 280px;
    overflow-y: auto;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #F8FAFC;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.recent-item:hover {
    background: #F1F5F9;
}

.recent-user {
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-type {
    font-size: 0.7rem;
}

.recent-style {
    font-weight: 600;
    color: #64748B;
    min-width: 20px;
}

.recent-date {
    font-size: 0.8rem;
    color: #94A3B8;
}

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

.footer a {
    color: var(--primary);
}

.footer-sub {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    opacity: 0.7;
}

.logged-in-footer {
    margin-top: auto;
    background: var(--bg-light);
    border-top: 1px solid var(--border);
}

.footer-session {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

.footer-session code {
    font-family: monospace;
    background: rgba(0,0,0,0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

/* Impersonation Banner */
.impersonate-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    z-index: 1001;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.impersonate-banner.hidden { display: none; }
.impersonate-banner button {
    background: white;
    color: #D97706;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}
.impersonate-banner button:hover { background: #FEF3C7; }

body.impersonating { padding-top: 50px; }

/* Profile badge in result */
.profile-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1.25rem;
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        padding: 1rem;
    }
    
    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
        gap: 0.5rem;
    }
    
    .container {
        padding: 1rem;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .profile-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-charts-grid {
        grid-template-columns: 1fr;
    }
    
    .comparison-grid {
        grid-template-columns: 1fr !important;
    }
}

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