/* TTC Wielsbeke-spotit - Custom Styles */

/* ============================================
   BRANDING & COLORS
   ============================================ */

:root {
    --ttc-dark: #1a1a1a;
    --ttc-red: #e21c21;
    --ttc-green: #7abf26;
    --ttc-blue: #0088cf;
    --ttc-teal: #1a5c6e;
}

/* Navbar */
.navbar.bg-dark {
    background-color: #d6eaf8 !important;
}

.navbar-logo {
    height: 40px;
    width: auto;
}

.sponsor-logo {
    height: 30px;
    width: auto;
    border-radius: 4px;
    background: white;
    padding: 2px 4px;
}

.footer-sponsor-logo {
    height: 22px;
    width: auto;
}

/* Brand stripe - red/green/blue accent under navbar */
.brand-stripe {
    height: 4px;
    background: linear-gradient(to right, var(--ttc-red) 33%, var(--ttc-green) 33%, var(--ttc-green) 66%, var(--ttc-blue) 66%);
}

/* Primary button/badge overrides to match brand */
.btn-primary {
    background-color: var(--ttc-dark);
    border-color: var(--ttc-dark);
}
.btn-primary:hover {
    background-color: #333;
    border-color: #333;
}
.btn-outline-primary {
    color: var(--ttc-dark);
    border-color: var(--ttc-dark);
}
.btn-outline-primary:hover {
    background-color: var(--ttc-dark);
    border-color: var(--ttc-dark);
}
.bg-primary {
    background-color: var(--ttc-dark) !important;
}

/* Active nav link accent */
.navbar-dark .nav-link.active {
    border-bottom: 2px solid var(--ttc-red);
    padding-bottom: calc(0.5rem - 2px);
}

/* Footer */
.site-footer {
    background-color: #f8f9fa;
    font-size: 0.85rem;
}

/* ============================================
   BESCHIKBAARHEID
   ============================================ */

/* Beschikbaarheid kleuren */
.avail-X  { background-color: #d4edda !important; color: #155724 !important; }
.avail-A  { background-color: #fff3cd !important; color: #856404 !important; }
.avail-N  { background-color: #fff3cd !important; color: #856404 !important; }
.avail-R  { background-color: #ffeeba !important; color: #856404 !important; }
.avail-RA { background-color: #ffeeba !important; color: #856404 !important; }
.avail-RN { background-color: #ffeeba !important; color: #856404 !important; }
.avail--  { background-color: #f8d7da !important; color: #721c24 !important; }
.avail-none { background-color: #e2e3e5 !important; color: #383d41 !important; }

/* Beschikbaarheid knoppen */
.availability-btn {
    min-width: 40px;
    min-height: 44px;
    font-weight: bold;
    transition: all 0.2s ease;
    border-width: 2px;
}

.availability-btn:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.availability-btn.active {
    font-weight: bold;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.2);
}

/* ============================================
   MATRIX TABEL
   ============================================ */

.matrix-table {
    font-size: 0.85rem;
}

.matrix-table th {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.matrix-table td {
    text-align: center;
    vertical-align: middle;
    min-width: 45px;
    padding: 4px 6px;
    font-weight: bold;
}

.matrix-table .player-name {
    white-space: nowrap;
    text-align: left;
    position: sticky;
    left: 0;
    background: white;
    z-index: 5;
    min-width: 150px;
}

.matrix-table .date-header {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    white-space: nowrap;
    padding: 8px 4px;
    font-size: 0.75rem;
}

/* Responsive matrix scroll */
.matrix-wrapper {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

/* Extra horizontale schuifbalk bovenaan de matrix (gesynchroniseerd via JS) */
.matrix-scroll-top {
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
}

/* Admin: klikbare beschikbaarheidscellen */
.clickable-cell {
    cursor: pointer;
    transition: opacity 0.15s;
}

.clickable-cell:hover {
    opacity: 0.7;
}

/* Beschikbaarheid popup */
.avail-popup {
    z-index: 1050;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 4px;
    min-width: 160px;
}

.avail-popup-btn {
    display: block;
    width: 100%;
    border: none;
    padding: 6px 10px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    margin-bottom: 2px;
}

.avail-popup-btn:last-child {
    margin-bottom: 0;
}

.avail-popup-btn:hover {
    opacity: 0.8;
}

/* ============================================
   OPSTELLING EDITOR
   ============================================ */

.lineup-slot {
    border: 2px dashed #dee2e6;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: border-color 0.2s;
}

.lineup-slot.filled {
    border-style: solid;
    border-color: var(--ttc-dark);
    background-color: #f5f5f5;
}

.lineup-slot.reserve {
    border-color: #ffc107;
    background-color: #fffcf0;
}

/* ============================================
   DRAG-AND-DROP AUTO-OPSTELLING
   ============================================ */

.draggable-row {
    cursor: grab;
    transition: opacity 0.2s, background-color 0.2s;
}

.draggable-row:active {
    cursor: grabbing;
}

.draggable-row.dragging {
    opacity: 0.3;
    background-color: #e9ecef;
}

.drag-handle {
    cursor: grab;
    padding: 0 4px !important;
}

.lineup-dropzone {
    min-height: 40px;
    transition: background-color 0.2s, border 0.2s;
    border: 2px solid transparent;
    border-radius: 4px;
}

.lineup-dropzone.drag-over {
    border: 2px dashed var(--ttc-blue);
    background-color: #f0f7ff;
}

.draggable-row.drop-above {
    border-top: 3px solid var(--ttc-blue) !important;
}

/* ============================================
   SPELERSPOOL (Auto-opstelling)
   ============================================ */

.player-pool-card {
    position: sticky;
    top: 1rem;
}

.player-pool-body {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.pool-item {
    cursor: grab;
    transition: opacity 0.2s, background-color 0.2s;
    font-size: 0.85rem;
}

.pool-item:active {
    cursor: grabbing;
}

.pool-item.dragging {
    opacity: 0.3;
    background-color: #e9ecef;
}

.pool-item.pool-allocated {
    opacity: 0.5;
    cursor: default;
    background-color: #f0f7ff;
}

.pool-item.pool-allocated .drag-handle-pool {
    visibility: hidden;
}

.pool-team-badge {
    font-size: 0.65em;
    vertical-align: middle;
    margin-left: 4px;
}

.pool-section-header {
    position: sticky;
    top: 0;
    z-index: 2;
}

.drag-handle-pool {
    cursor: grab;
    padding: 0 4px !important;
}

.remove-from-team {
    font-size: 0.65rem;
    line-height: 1;
    border-radius: 3px;
}

.remove-from-team:hover {
    background-color: #dc3545;
    color: white;
}

/* ============================================
   GENERAL UI
   ============================================ */

/* Kaart schaduwen */
.card {
    border-radius: 8px;
}

.card-header {
    background-color: #f8f9fa;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

/* Smartphone (<768px) */
@media (max-width: 767.98px) {
    /* Spelerspool: onder ploegen op mobiel */
    .player-pool-card {
        position: static;
        margin-top: 1rem;
    }

    .player-pool-body {
        max-height: 400px;
    }

    /* Ruimte */
    main.container {
        padding-left: 10px;
        padding-right: 10px;
    }

    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.1rem; }

    /* Navbar logo kleiner op mobiel */
    .navbar-logo {
        height: 32px;
    }

    /* Beschikbaarheid knoppen - grotere touch targets */
    .availability-buttons {
        display: flex !important;
        flex-wrap: wrap;
        gap: 4px;
    }

    .availability-buttons .availability-btn {
        flex: 1 1 auto;
        min-width: 44px;
        min-height: 44px;
        padding: 8px 4px;
        font-size: 0.85rem;
    }

    /* Dashboard beschikbaarheids-cards */
    .availability-card .card-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px;
    }

    /* Wedstrijd rij in dashboard */
    .match-row {
        flex-wrap: wrap;
        gap: 4px;
    }

    .match-row .match-detail {
        font-size: 0.85rem;
    }

    /* Matrix tabel compact */
    .matrix-table {
        font-size: 0.7rem;
    }

    .matrix-table td {
        min-width: 32px;
        padding: 3px 2px;
    }

    .matrix-table .player-name {
        min-width: 90px;
        max-width: 110px;
        font-size: 0.7rem;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .matrix-table .date-header {
        font-size: 0.6rem;
        padding: 6px 2px;
    }

    /* Tabellen - horizontaal scrollen */
    .table-responsive-mobile {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-sm td, .table-sm th {
        padding: 0.3rem 0.4rem;
        font-size: 0.8rem;
    }

    /* Cards compacter */
    .card-body { padding: 0.75rem; }
    .card-header { padding: 0.5rem 0.75rem; }

    /* Lineup editor */
    .lineup-slot { padding: 8px; }
    .lineup-slot .form-select { font-size: 0.85rem; }

    /* Lineup header knoppen: wrap */
    .lineup-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .lineup-actions .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.4rem;
    }

    /* Legende badges compact */
    .legend-bar .badge {
        font-size: 0.7rem;
        padding: 4px 6px;
    }

    /* Navbar */
    .navbar-brand {
        max-width: 200px;
    }

    /* Welkomst tekst */
    .lead { font-size: 1rem; }

    /* Tabellen: word wrap */
    .table td, .table th {
        white-space: normal;
        word-break: break-word;
    }
}

/* Tablet (768px - 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .matrix-table { font-size: 0.8rem; }

    .matrix-table .player-name { min-width: 130px; }

    .availability-btn {
        min-width: 42px;
        min-height: 42px;
    }
}

/* Heel klein scherm (<576px) */
@media (max-width: 575.98px) {
    /* Ranking badge verbergen in navbar */
    .navbar .badge.bg-light {
        display: none;
    }

    /* Filter form: full-width knoppen */
    .filter-form .btn {
        width: 100%;
    }

    /* Nog kleinere logo op heel klein scherm */
    .navbar-logo {
        height: 28px;
    }
}
