/* =============================
   SHARED STYLES - BusinessGame
   Full file (complete)
   ============================= */

/* Google font import */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400;600;700;900&display=swap');

:root {
    --nachtblauw: #1f416b;
    --helderwit: #ffffff;
    --printerzwart: #181716;
    --mistblauw: #d3ddf2;
    --muntgroen: #3cb497;
    --stormblauw: #00639c;
    --warmrood: #e73f16;

    --space-xs: 6px;
    --space-sm: 10px;
    --space-md: 16px;
    --space-lg: 20px;
    --space-xl: 28px;

    --font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

/* Base body styling for pages that use shared.css */
body {
    font-family: var(--font-family);
    background: #f5f7fa;
    color: var(--printerzwart);
    font-size: 18px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 700;
    color: var(--nachtblauw);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

h1 {
    font-size: 32px;
}

h2 {
    font-size: 26px;
}

h3 {
    font-size: 22px;
}

/* Buttons and common interactive elements */
button,
.btn,
.save-button {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: var(--font-family);
    display: inline-block;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary,
.save-button {
    background: var(--stormblauw);
    color: var(--helderwit);
}

.btn-primary:hover:not(:disabled),
.save-button:hover:not(:disabled) {
    background: var(--nachtblauw);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button:disabled,
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Form controls */
input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
    background: var(--helderwit);
    border: 2px solid var(--mistblauw);
    color: var(--printerzwart);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 17px;
    transition: all 0.2s;
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input::placeholder,
textarea::placeholder {
    color: rgba(24, 23, 22, 0.45);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--stormblauw);
    box-shadow: 0 0 0 3px rgba(0, 99, 156, 0.1);
}

input[readonly] {
    background: #f5f7fa;
    border-color: #e0e6ed;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Layout helpers */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.flex {
    display: flex;
}

/* Sidebar (used on main app pages) */
.sidebar {
    width: 16rem;
    background: linear-gradient(180deg, var(--nachtblauw) 0%, #152c4a 100%);
    box-shadow: 2px 0 12px rgba(31, 65, 107, 0.15);
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    padding: 20px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo h1 {
    font-size: 24px;
    font-weight: 900;
    color: var(--helderwit);
}

/* Small decorative underline used across pages */
.logo-underline {
    height: 3px;
    width: 60px;
    margin: 8px auto 0;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--stormblauw), var(--muntgroen));
}

/* Navigation item */
.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 6px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
}

.nav-item.active {
    background: var(--stormblauw);
    color: var(--helderwit);
    box-shadow: 0 2px 8px rgba(0, 99, 156, 0.28);
}

.nav-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
}

/* Notification badge on the "Messages" nav item — shows the number of
   unread admin messages. Pushed to the right edge of the nav item. */
.nav-badge {
    margin-left: auto;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--warmrood);
    color: var(--helderwit);
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(231, 63, 22, 0.35);
}

/* Make the toast clickable when it links to the messages page */
.notification-toast.clickable {
    cursor: pointer;
}

/* Main content */
.main-content {
    flex: 1;
    padding: 20px 24px;
    overflow: auto;
}

.page-title {
    font-size: 32px;
    font-weight: 900;
    color: var(--nachtblauw);
    margin-bottom: 8px;
}

.page-divider {
    height: 3px;
    background: linear-gradient(90deg, var(--stormblauw), var(--muntgroen), transparent);
    border: none;
    border-radius: 3px;
    margin-bottom: 20px;
}

/* Data card sections */
.data-section {
    background: var(--helderwit);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(31, 65, 107, 0.08);
    margin-bottom: 20px;
    overflow: hidden;
}

.section-header {
    background: linear-gradient(135deg, var(--nachtblauw) 0%, var(--stormblauw) 100%);
    padding: 14px 20px;
    position: relative;
}

.section-header h2 {
    color: var(--helderwit);
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    position: relative;
    z-index: 1;
}

.section-header::before {
    content: '';
    position: absolute;
    right: -20px;
    top: -20px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--muntgroen);
    opacity: 0.15;
}

.section-header::after {
    content: '';
    position: absolute;
    left: 60%;
    bottom: -15px;
    width: 50px;
    height: 50px;
    background: var(--warmrood);
    opacity: 0.12;
    transform: rotate(45deg);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--nachtblauw);
}

thead th {
    color: var(--helderwit);
    font-weight: 700;
    text-align: left;
    padding: 14px 12px;
    font-size: 15px;
    text-transform: uppercase;
}

tbody tr {
    transition: all 0.2s;
    border-bottom: 1px solid #e8ecf1;
}

tbody tr:hover {
    background: #f8fafb;
}

tbody td {
    padding: 12px;
    color: var(--printerzwart);
    font-size: 17px;
}

/* Toast notifications */
.notification-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    color: var(--helderwit);
    font-weight: 600;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    animation: slideIn 0.25s ease both;
    min-width: 300px;
    max-width: 480px;
    white-space: pre-line; /* respect newlines in error messages with field lists */
    line-height: 1.4;
}

.notification-toast.success {
    background: var(--muntgroen);
}

.notification-toast.error {
    background: var(--warmrood);
}

/* === Round Reliability Warning Banner ===
 * Shown on /outputs, /analyses and /market-reports when the displayed round
 * was simulated with incomplete inputs (one or more teams didn't fill in).
 * Outputs from such rounds are unreliable (impossible market shares + €0
 * revenue), so we warn the user instead of silently showing garbage.
 */
.round-reliability-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #fff7e6;
    border-left: 5px solid #d97706;
    border-radius: 10px;
    padding: 14px 18px;
    margin: 16px 0 24px 0;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.10);
    color: #7c2d12;
}

.round-reliability-warning .rrw-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.round-reliability-warning .rrw-body {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
}

.round-reliability-warning .rrw-title {
    font-weight: 800;
    font-size: 15px;
    color: #92400e;
    margin-bottom: 6px;
}

.round-reliability-warning .rrw-text {
    color: #7c2d12;
}

.round-reliability-warning .rrw-text em {
    font-style: normal;
    font-weight: 700;
    color: #92400e;
}

.round-reliability-warning .rrw-text ul {
    list-style: disc;
    padding-left: 18px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logo badge: ensures logo has a light background and padding so it reads on any background */
.logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--helderwit);
    /* white/light background */
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(31, 65, 107, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.04);
    margin: 0 auto 10px auto;
    width: auto;
    max-width: 220px;
}

/* ===============================================
   DASHBOARD - Key Metrics Display
   =============================================== */

.dashboard {
    background: var(--helderwit);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(31, 65, 107, 0.08);
    padding: 20px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
}

.metric-card {
    padding: 16px;
    background: linear-gradient(135deg, rgba(31, 65, 107, 0.05), rgba(0, 99, 156, 0.05));
    border-radius: 6px;
    border-left: 4px solid var(--stormblauw);
    text-align: center;
    transition: all 0.2s ease;
}

.metric-card:hover {
    box-shadow: 0 2px 8px rgba(31, 65, 107, 0.12);
    transform: translateY(-2px);
}

.metric-label {
    font-size: 12px;
    color: var(--nachtblauw);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--nachtblauw);
}

.metric-value.positive {
    color: var(--muntgroen);
}

.metric-value.negative {
    color: var(--warmrood);
}

/* Highlighted "Geld op zak" card — the most important number on the dashboard */
.metric-card.metric-card-cash {
    background: linear-gradient(135deg, #d9f6ec 0%, #c4f0e0 100%);
    border-left-color: var(--muntgroen, #1f7965);
    box-shadow: 0 2px 10px rgba(31, 121, 101, 0.15);
}

.metric-card.metric-card-cash .metric-label {
    color: #14573f;
    font-weight: 700;
}

.metric-card.metric-card-cash .metric-value {
    color: #14573f;
}

.metric-card .metric-sub {
    margin-top: 4px;
    font-size: 10px;
    opacity: 0.65;
    font-style: italic;
    text-transform: none;
    letter-spacing: 0;
}


/* Dashboard Responsive Design */
@media (max-width: 1024px) {
    .dashboard {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
        padding: 16px;
    }

    .metric-card {
        padding: 12px;
    }

    .metric-value {
        font-size: 20px;
    }

    .metric-label {
        font-size: 11px;
    }
}

@media (max-width: 768px) {
    .dashboard {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 12px;
    }

    .metric-card {
        padding: 10px;
    }

    .metric-value {
        font-size: 18px;
    }

    .metric-label {
        font-size: 10px;
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

/* Responsive */
@media (max-width: 1024px) {
    .page-title {
        font-size: 28px;
    }

    .section-header h2 {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 16px;
    }

    .page-title {
        font-size: 24px;
    }

    .save-button {
        width: 100%;
    }
}

/* =============================================================
   MOBIELE RESPONSIVE LAAG — app-breed (spelers + admin)
   Stapelt de zijbalk boven de inhoud, maakt tabellen scrollbaar,
   stapelt formulier-rijen en maakt modals bijna-fullscreen.
   ============================================================= */
@media (max-width: 768px) {
    /* Zijbalk + content onder elkaar i.p.v. naast elkaar */
    .flex.h-screen {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    .sidebar {
        width: 100% !important;
        height: auto;
    }
    .sidebar-logo {
        padding: 12px 16px;
    }
    .sidebar-logo .logo-badge,
    .logo-badge {
        max-width: 140px;
        margin: 0 auto 6px;
    }
    /* Navigatie als horizontaal scrollbare balk */
    .nav-section {
        flex: none !important;
        padding-bottom: 4px;
    }
    .nav-section ul {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 6px;
        -webkit-overflow-scrolling: touch;
    }
    .nav-section ul > li {
        flex: 0 0 auto;
    }
    .nav-item {
        margin-bottom: 0;
        white-space: nowrap;
    }
    .nav-badge {
        margin-left: 8px;
    }
    .team-info,
    .admin-info {
        padding: 8px 16px;
    }
    .logout-section {
        padding: 8px 16px;
    }
    .logout-section .credits {
        display: none;
    }
    .main-content {
        padding: 12px;
    }

    /* Tabellen horizontaal scrollbaar binnen hun container */
    .data-section,
    .dashboard,
    .table-container,
    .mc-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Formulier-rijen stapelen tot één kolom */
    .row {
        flex-direction: column;
        align-items: stretch;
    }
    .row > div,
    .field {
        min-width: 0 !important;
        width: 100%;
        flex: 1 1 auto !important;
    }

    /* Modals (admin) bijna fullscreen + scrollbaar */
    .modal-content {
        max-width: 96vw !important;
        width: 96vw;
        margin: 10px auto;
        max-height: 92vh;
        overflow-y: auto;
    }

    /* Game-kaarten in de admin: kop + knoppen mogen wrappen */
    .card-header {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* Heel kleine schermen (telefoons in portret) */
@media (max-width: 480px) {
    .dashboard {
        grid-template-columns: 1fr;
    }
    .section-header h2 {
        font-size: 18px;
    }
    .nav-text {
        font-size: 14px;
    }
    .page-title {
        font-size: 20px;
    }
}

/* Gerichte mobiele fixes tegen overlappende/afgesneden inhoud */
@media (max-width: 768px) {
    /* Brede tabellen krijgen een minimumbreedte zodat ze SCROLLEN binnen hun
       container i.p.v. samengeperst of afgesneden te worden. */
    .table-container table,
    .mc-table-wrap table,
    .modal-body .results-table {
        min-width: 480px;
    }
    /* Modal-inhoud (bv. brede resultaattabellen) horizontaal scrollbaar. */
    .modal-body {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* Sectiekoppen met titel + knoppen/acties mogen netjes afbreken. */
    .section-header-topline,
    .section-title-group,
    .section-header-actions,
    .save-row,
    .page-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    /* Geen horizontale pagina-overflow door losse brede elementen. */
    .max-w-7xl,
    .container {
        max-width: 100%;
    }
}

/* ===============================================
   ODISEE-LOGO — klein wit badge, op elke pagina
   onder het BusinessGame-logo (sidebar/header).
   =============================================== */
.odisee-logo-badge {
    background: var(--helderwit, #fff);
    border-radius: 8px;
    padding: 5px 10px;
    display: inline-block;
    margin-top: 10px;
}

.odisee-logo-badge img {
    height: 24px;
    width: auto;
    display: block;
}
