/* ============================================================
   Computrain huisstijl
   Primair rood:     #E41E2D
   Diep zwartgrijs:  #131E29
   Donkerpaars:      #3B1E63
   Warmgrijs licht:  #D2CDCD
   Warmgrijs donker: #BDB4B4
   Accentgeel:       #FFE600
   ============================================================ */

/* Algemene layout */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #ffffff;
    color: #131E29;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.site-header {
    background: #ffffff;
    color: #131E29;
    padding: 12px 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    position: relative;
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.btn-beheer {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: #BDB4B4;
    text-decoration: none;
    border: 1px solid #BDB4B4;
    padding: 4px 10px;
    white-space: nowrap;
}

.btn-beheer:hover {
    color: #131E29;
    border-color: #131E29;
}

.logo-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.title-block h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #131E29;
}

.subtitle {
    margin: 2px 0 0;
    font-size: 0.9rem;
    color: #555;
}

/* Content */
.content {
    flex: 1;
    max-width: 1100px;
    margin: 20px auto;
    padding: 0 16px 24px;
}

/* Kaarten / secties */
.intro-card,
.table-card,
.footer-note {
    background: #fff;
    border-radius: 0;
    padding: 10px 18px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    border-left: 4px solid #E41E2D;
}

.intro-card h2 {
    margin-top: 0;
    color: #E41E2D;
}

.intro-card h3,
.table-card h3 {
    color: #131E29;
}

.info-text {
    font-size: 0.9rem;
    color: #555;
}

.info-text code {
    background: #D2CDCD;
    padding: 2px 4px;
    font-family: "Courier New", monospace;
}

/* Tabel met bestanden */
.table-wrapper {
    overflow-x: auto;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
}

.file-table thead {
    background: #E41E2D;
}

.file-table th,
.file-table td {
    padding: 10px 8px;
    text-align: left;
    font-size: 0.95rem;
    border-bottom: 1px solid #BDB4B4;
}

.file-table th {
    font-weight: 700;
    color: #ffffff;
}

.file-table tr:hover {
    background: #D2CDCD;
}

.file-name a {
    color: #131E29;
    text-decoration: none;
    font-weight: 500;
}

.file-name a:hover {
    color: #E41E2D;
    text-decoration: underline;
}

/* Downloadknop */
.download-cell {
    text-align: right;
}

.btn-download {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.9rem;
    border-radius: 0;
    border: none;
    text-decoration: none;
    background: #E41E2D;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-download:hover {
    background: #131E29;
    color: #ffffff;
}

/* Footer */
.site-footer {
    text-align: center;
    font-size: 0.85rem;
    color: #131E29;
    background: #BDB4B4;
    padding: 10px 16px 16px;
}

/* Responsiveness */
@media (max-width: 600px) {
    .logo-title {
        flex-direction: row;
        align-items: center;
    }

    .title-block h1 {
        font-size: 1.25rem;
    }

    .file-table th:nth-child(3),
    .file-table td:nth-child(3) {
        display: none;
    }
}

/* Eenvoudige formulierstijl voor login en upload */
.simple-form {
    max-width: 420px;
    margin-top: 12px;
}

.form-row {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-row label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #131E29;
}

.simple-form input[type="text"],
.simple-form input[type="password"],
.simple-form input[type="file"] {
    padding: 8px;
    border-radius: 0;
    border: 1px solid #BDB4B4;
    font-size: 0.95rem;
    font-family: Arial, sans-serif;
}

.simple-form input[type="text"]:focus,
.simple-form input[type="password"]:focus,
.simple-form input[type="file"]:focus {
    outline: none;
    border-color: #3B1E63;
    box-shadow: 0 0 0 1px rgba(59,30,99,0.2);
}

.form-actions {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.link-secondary {
    font-size: 0.9rem;
    color: #131E29;
    text-decoration: none;
}

.link-secondary:hover {
    color: #E41E2D;
    text-decoration: underline;
}

/* Badges voor rollen in admin-scherm */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 2px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-admin {
    background: #131E29;
    color: #fff;
}

.badge-uploader {
    background: #D2CDCD;
    color: #131E29;
}

/* Kleine knoppen in admin */
.btn-small {
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.8rem;
    border-radius: 0;
    border: none;
    background: #131E29;
    color: #fff;
    cursor: pointer;
    font-family: Arial, sans-serif;
}

.btn-small:hover {
    background: #3B1E63;
}

.btn-danger {
    background: #E41E2D;
}

.btn-danger:hover {
    background: #131E29;
}

/* Categorie-accordion op de publieke downloadpagina */
.category-accordion {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.category-section {
    border: 1px solid #BDB4B4;
    border-radius: 0;
    overflow: hidden;
    background: #fff;
}

.category-header {
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: #131E29;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 0.95rem;
}

.category-header:hover {
    background: #3B1E63;
}

.category-title {
    font-weight: 700;
    color: #ffffff;
}

.category-count {
    font-size: 0.85rem;
    color: #D2CDCD;
    margin-right: 8px;
}

.category-toggle-indicator {
    font-weight: 700;
    font-size: 1.1rem;
    width: 18px;
    text-align: center;
    color: #ffffff;
}

/* Accordion: grid-truc voor vloeiende animatie zonder layout-reflow */
.category-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.25s ease;
    overflow: hidden;
}

.category-body > .table-wrapper {
    overflow: hidden;
    min-height: 0;
}

.category-section.open .category-body {
    grid-template-rows: 1fr;
}

/* Open accordion-header krijgt rode accentkleur */
.category-section.open .category-header {
    background: #E41E2D;
}

.category-section.open .category-header:hover {
    background: #131E29;
}

/* ----------------------------------------------------------- */
/*  VASTE BREEDTES voor ALLE tabellen in de accordion          */
/* ----------------------------------------------------------- */

.category-accordion table.file-table {
    table-layout: fixed !important;
    width: 100%;
}

/* Kolom 1 = bestandsnaam → breedste */
.category-accordion table.file-table th:nth-child(1),
.category-accordion table.file-table td:nth-child(1) {
    width: 100%;
    overflow-wrap: anywhere;
}

/* Kolom 2 = Grootte → vaste breedte, rechts uitgelijnd */
.category-accordion table.file-table th:nth-child(2),
.category-accordion table.file-table td:nth-child(2) {
    width: 120px;
    text-align: right;
    white-space: nowrap;
}

/* Kolom 3 = Downloadknop → vaste breedte */
.category-accordion table.file-table th:nth-child(3),
.category-accordion table.file-table td:nth-child(3) {
    width: 140px;
    text-align: right;
    white-space: nowrap;
}

/* Zorgen dat downloadknop nooit breekt */
.category-accordion .btn-download {
    white-space: nowrap;
}

/* Hero-afbeelding op de downloadpagina */
.hero-section {
    max-width: 1288px;
    margin: 16px auto 0;
    padding: 0 16px;
}

.hero-inner {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}

.hero-image {
    display: block;
    width: 100%;
    aspect-ratio: 1300 / 543;
    object-fit: cover;
    object-position: center;
}

.hero-overlay {
    display: none;
}

.hero-content {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 40px;
    max-width: 580px;
}

.hero-subtitle {
    margin: 0 0 8px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.75);
}

.hero-title {
    margin: 0;
    font-size: 2.75rem;
    font-weight: 600;
    line-height: 1.1;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

@media (max-width: 600px) {
    .hero-content {
        left: 20px;
        max-width: calc(100% - 40px);
    }

    .hero-title {
        font-size: 1.5rem;
    }
}

/* Header + zoekveld boven de categorie-accordion */
.download-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.download-header-row h3 {
    margin: 0;
}

/* Zoekformulier rechts */
.download-search {
    display: flex;
    align-items: center;
    gap: 6px;
}

.download-search input[type="text"] {
    padding: 6px 8px;
    border-radius: 0;
    border: 1px solid #BDB4B4;
    font-size: 0.9rem;
    min-width: 220px;
    font-family: Arial, sans-serif;
}

.download-search input[type="text"]:focus {
    outline: none;
    border-color: #3B1E63;
    box-shadow: 0 0 0 1px rgba(59,30,99,0.2);
}

.download-search button {
    border: none;
    border-radius: 0;
    padding: 6px 10px;
    font-size: 0.95rem;
    cursor: pointer;
    background: #E41E2D;
    color: #fff;
    font-family: Arial, sans-serif;
}

.download-search button:hover {
    background: #131E29;
}

/* Feedback-meldingen */
.msg-success {
    color: #007f3f;
    font-weight: 600;
}

.msg-error {
    color: #E41E2D;
    font-weight: 600;
}

/* Beheerpagina: layout met linker navigatiebalk (vast, zoals Portainer) */
.beheer-layout {
    flex: 1;
    display: flex;
}

.beheer-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #fff;
    box-shadow: 2px 0 4px rgba(0,0,0,0.08);
    padding: 90px 12px 12px;
    overflow-y: auto;
    z-index: 50;
}

.beheer-nav-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-left: 4px solid transparent;
    padding: 10px 12px;
    font-size: 0.95rem;
    font-family: Arial, sans-serif;
    color: #131E29;
    text-decoration: none;
    cursor: pointer;
}

.beheer-nav-item:hover {
    background: #D2CDCD;
}

.beheer-nav-item.active {
    border-left-color: #E41E2D;
    background: #D2CDCD;
    font-weight: 700;
}

.beheer-nav-secondary {
    margin-top: 8px;
    border-top: 1px solid #D2CDCD;
    padding-top: 12px;
    color: #555;
    font-size: 0.9rem;
}

.beheer-content {
    flex: 1;
    min-width: 0;
    margin-left: 220px;
    max-width: 1100px;
    padding: 20px 16px 24px;
}

.beheer-panel {
    display: none;
}

.beheer-panel.active {
    display: block;
}

@media (max-width: 700px) {
    .beheer-layout {
        flex-direction: column;
    }

    .beheer-sidebar {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        height: auto;
        padding: 12px;
    }

    .beheer-content {
        margin-left: 0;
    }

    .beheer-nav-item {
        width: auto;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .beheer-nav-item.active {
        border-left-color: transparent;
        border-bottom-color: #E41E2D;
    }
}

/* Klein hulpelement voor screenreaders (label verbergen, maar wel toegankelijk) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ===================== DOWNLOAD DASHBOARD ===================== */
.dl-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.dl-kpi-card {
    background: #fff;
    border-left: 4px solid #E41E2D;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    padding: 14px 16px 12px;
    border-radius: 0;
}

.dl-kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: #131E29;
    line-height: 1.1;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dl-kpi-value--sm {
    font-size: 1.1rem;
    font-weight: 600;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
}

.dl-kpi-label {
    font-size: 0.8rem;
    color: #555;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.dl-kpi-badge {
    background: #E41E2D;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    white-space: nowrap;
}

/* Top 5 balk */
.dl-top5 {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 0 6px;
}

.dl-top5-row {
    display: grid;
    grid-template-columns: 200px 1fr 48px;
    align-items: center;
    gap: 12px;
}

.dl-top5-name {
    font-size: 0.85rem;
    color: #131E29;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dl-top5-bar-wrap {
    background: #f0f0f0;
    border-radius: 3px;
    height: 14px;
    overflow: hidden;
}

.dl-top5-bar {
    height: 100%;
    background: #E41E2D;
    border-radius: 3px;
    min-width: 4px;
    transition: width 0.3s ease;
}

.dl-top5-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: #131E29;
    text-align: right;
    white-space: nowrap;
}

/* Paginering */
.dl-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.dl-page-info {
    font-size: 0.85rem;
    color: #555;
}

.dl-page-btns {
    display: flex;
    gap: 6px;
}

/* Responsive: 2 kolommen op tablet */
@media (max-width: 900px) {
    .dl-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .dl-top5-row {
        grid-template-columns: 140px 1fr 40px;
    }
}

/* Responsive: 1 kolom op mobiel */
@media (max-width: 600px) {
    .dl-cards {
        grid-template-columns: 1fr 1fr;
    }
    .dl-top5-row {
        grid-template-columns: 110px 1fr 36px;
    }
}
