/* =========================================
   DC DEN BLAAN - CSS ARCHITECTUUR
   ========================================= */
:root {
    --color-primary: #009FE3;
    --color-primary-dark: #007BB5;
    --color-bg: #121212;
    --color-surface: #1E1E1E;
    --color-text: #FFFFFF;
    --color-text-muted: #A0A0A0;
    --color-border: #333333;
    --color-success: #28a745;
    --color-danger: #dc3545;
    --color-warning: #ffc107;
    --font-main: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --radius: 8px;
    --transition: 0.3s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
}

*::-webkit-scrollbar {
    display: none !important;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.text-blue {
    color: var(--color-primary);
}

.app-header {
    background-color: var(--color-surface);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--color-primary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-text {
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.main-content {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.live-matches-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Live Viewers Badge (Nu een stuk compacter en kleiner) */
.viewer-badge {
    color: var(--color-success);
    font-weight: bold;
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--color-success);
    border-radius: var(--radius);
    background: rgba(40, 167, 69, 0.1);
    display: flex;
    align-items: center;
}

.matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.empty-state {
    color: var(--color-text-muted);
    font-style: italic;
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
}

.btn {
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-size: 0.9rem;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
}

.btn-outline {
    background-color: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.btn-outline:hover {
    background-color: var(--color-primary);
    color: #fff;
}

.btn-text {
    background: none;
    color: var(--color-text-muted);
}

.btn-text:hover {
    color: var(--color-text);
}

.btn-danger {
    background-color: var(--color-danger);
    color: #fff;
}

.btn-success {
    background-color: var(--color-success);
    color: #fff;
}

.btn-warning {
    background-color: var(--color-warning);
    color: #212529;
}

.btn-block {
    flex-basis: 100%;
    width: 100%;
    margin-bottom: 0.5rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-weight: bold;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.score-section {
    margin-bottom: 1.5rem;
    background: var(--color-bg);
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.score-section h4 {
    color: var(--color-primary);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.5rem;
}

.score-row {
    display: flex;
    gap: 6px;
    margin-bottom: 0.6rem;
    align-items: center;
}

.score-row-bottom {
    margin-bottom: 1.2rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.5rem;
}

.score-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.score-col.wide {
    flex: 2;
}

.score-col label {
    font-size: 0.60rem;
    color: var(--color-text-muted);
    margin: 0;
    text-align: center;
    white-space: nowrap;
}

.score-col input {
    padding: 0.4rem;
    text-align: center;
    font-size: 0.85rem;
    font-weight: bold;
}

.score-col.wide input {
    text-align: left;
    font-weight: normal;
}

.row-index {
    width: 15px;
    font-weight: bold;
    color: var(--color-primary);
    font-size: 0.8rem;
}

.row-spacer {
    width: 15px;
}

.readonly-pt {
    background: transparent !important;
    border: none !important;
    color: var(--color-primary) !important;
    font-size: 1rem !important;
}

.status-col select {
    padding: 0.3rem;
    font-size: 0.75rem;
}

.stat-row {
    align-items: stretch;
}

.admin-list {
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
}

.admin-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    border-bottom: 1px solid var(--color-border);
}

/* =========================================
   NATIVE SCROLLING & MODALS (TABLET FIX)
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 2rem;
}

.modal-content {
    background-color: var(--color-surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    border-top: 4px solid var(--color-primary);
}

.modal-xl {
    max-width: 900px;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.mobile-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.flex-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.form-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 0.5rem;
    min-height: 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.hide-desktop {
    display: none !important;
}

/* PDF View Styles */
.modal-pdf-wrapper {
    max-width: 800px;
    padding: 1rem;
    background-color: #f5f5f5;
    border-top: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
    border: 1px solid #ccc;
    background: #fff;
}

.pdf-sheet {
    background: #FFFFFF;
    color: #000000;
    padding: 2rem;
    font-family: 'Arial', sans-serif;
    font-size: 0.9rem;
}

.pdf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #000;
    padding-bottom: 1rem;
}

.pdf-header-text {
    flex: 1;
    text-align: center;
}

.pdf-header-text h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.pdf-logo {
    max-width: 80px;
    max-height: 80px;
    object-fit: contain;
}

.pdf-meta {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.pdf-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.pdf-table th,
.pdf-table td {
    border: 1px solid #000;
    padding: 0.4rem;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

.pdf-table th {
    background-color: #e9ecef;
    font-weight: bold;
    font-size: 0.85rem;
}

.pdf-table .text-left {
    text-align: left;
    padding-left: 0.5rem;
    white-space: normal;
}

.pdf-table tr.active-row {
    background-color: #e0f4fc;
    border: 2px solid var(--color-primary);
}

.pdf-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.pdf-box {
    border: 1px solid #000;
    padding: 0.5rem;
    min-height: 60px;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background-color: var(--color-surface);
    color: var(--color-text);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    border-left: 4px solid var(--color-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease forwards;
    min-width: 250px;
}

.toast.success {
    border-left-color: var(--color-success);
}

.toast.error {
    border-left-color: var(--color-danger);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.hidden {
    display: none !important;
}

/* =========================================
   NATIVE MOBILE OPTIMIZATION (TABLET / SMARTPHONE)
   ========================================= */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }

    .hide-desktop {
        display: flex !important;
    }

    .app-header {
        flex-direction: column;
        gap: 10px;
        padding: 1rem;
    }

    .auth-controls {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .live-matches-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    #adminControls {
        flex-direction: column;
        width: 100%;
    }

    #adminControls button,
    #adminControls div {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .modal-overlay {
        padding: 0;
    }

    .modal-content {
        height: 100%;
        border-radius: 0;
        border-top: none;
        padding: 1rem;
    }

    .modal-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-actions .btn {
        width: 100%;
        margin: 0;
    }

    .score-section {
        padding: 0.5rem;
        border: none;
        border-bottom: 2px solid var(--color-primary);
        border-radius: 0;
        margin-bottom: 2rem;
    }

    .score-row {
        flex-wrap: wrap;
        margin-bottom: 0.8rem;
    }

    .score-row-bottom {
        border-bottom: 1px dashed var(--color-border);
        padding-bottom: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .row-index {
        width: 100%;
        text-align: left;
        border-bottom: 1px solid var(--color-border);
        margin-bottom: 0.5rem;
        padding-bottom: 0.3rem;
    }

    .row-spacer {
        display: none;
    }

    .score-col.wide {
        flex: 1 1 100%;
        margin-bottom: 0.5rem;
    }

    .score-col {
        flex: 1 1 45%;
        min-width: 60px;
        margin-bottom: 0.5rem;
    }

    .status-col {
        flex: 1 1 100% !important;
        margin-top: 0.5rem;
    }

    .stat-row {
        flex-wrap: nowrap;
        align-items: stretch;
    }

    .stat-row .score-col.wide {
        flex: 2;
        margin-bottom: 0;
    }

    .stat-row .score-col {
        flex: 1;
        margin-bottom: 0;
    }

    .stat-row button {
        height: 100%;
        margin-top: 1.2rem;
    }

    .pdf-sheet {
        padding: 1rem;
    }

    .pdf-header {
        flex-direction: column;
        gap: 1rem;
    }

    .pdf-meta {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        text-align: center;
        margin-bottom: 1rem;
    }

    .pdf-stats-grid {
        grid-template-columns: 1fr;
    }

    .pdf-signatures {
        flex-direction: row;
        justify-content: space-between;
        gap: 10px;
        align-items: flex-start;
        margin-top: 1.5rem;
    }

    .pdf-sig-box {
        width: 48%;
        max-width: none;
        font-size: 0.75rem;
        padding-top: 0.4rem;
    }
}