/**
 * OE Tantárgyi Kataszter v1.0 - Frontend stílusok.
 *
 * Bootstrap 5.3-ra épít. Csak az OE-specifikus finomítások.
 */

/* =========================================================================
 * Design-tokenek
 * ========================================================================= */
:root {
    --oe-primary: #00288C;
    --oe-primary-light: #1a3fa0;
    --oe-primary-dark: #001a5c;
    --oe-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    --oe-card-hover-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --oe-section-gap: 1rem;
    --oe-field-gap: 0.75rem;
}

/* =========================================================================
 * Általános: container szellősebb, h1 hangsúlyosabb
 * ========================================================================= */
.container.my-4 > h1,
.container.my-5 > h1 {
    padding-top: 0.85rem; /* több levegő felül, hogy a cím ne tapadjon a lap/kártya tetejéhez */
    margin-bottom: 1rem;
    color: var(--oe-primary, #00288C);
    font-weight: 600;
}
/* A col-lg-8 tartalmi oszlop címsora (részletes nézet) is kapjon felső levegőt */
.container .row > .col-lg-8 > h1 {
    padding-top: 0.5rem;
}

/* Tooltip-kurzor + ikon távolság a label-től */
.form-label .bi {
    cursor: help;
    margin-left: 0.25rem;
    font-size: 0.9em;
    color: #6c757d;
    vertical-align: -1px;
}
.form-label .text-danger {
    margin-left: 0.125rem;
}

/* =========================================================================
 * Card-ok (fieldset-szerű blokkok az űrlapon és sidebar-on)
 * ========================================================================= */
.oe-tantargy-form .card,
.container.my-4 > .card {
    border: 1px solid #dee2e6;
    box-shadow: var(--oe-card-shadow);
    margin-bottom: var(--oe-section-gap);
}
.oe-tantargy-form .card-header,
.container.my-4 > .card > .card-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0.75rem 1rem;
    font-weight: 500;
}
.oe-tantargy-form .card-body {
    padding: 1.25rem;
}
.oe-tantargy-form .card-body p.small.text-muted:first-child {
    margin-top: -0.25rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* =========================================================================
 * Form-elemek
 * ========================================================================= */
.oe-tantargy-form .form-label {
    margin-bottom: 0.35rem;
    font-weight: 500;
}
.oe-tantargy-form .form-control:focus,
.oe-tantargy-form .form-select:focus {
    border-color: var(--oe-primary-light, #1a3fa0);
    box-shadow: 0 0 0 0.2rem rgba(0, 40, 140, 0.15);
}
.oe-tantargy-form .invalid-feedback {
    font-size: 0.825rem;
    margin-top: 0.25rem;
}
.oe-tantargy-form .is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.15rem rgba(220, 53, 69, 0.1);
}
.oe-tantargy-form .row.g-3 {
    --bs-gutter-y: 1rem;
}
/* Alsó akciógombok (mentés/beküldés stb.) ne tapadjanak a kártya aljához */
.oe-tantargy-form .card-body > .d-flex.gap-2:last-child,
.oe-tantargy-form .card-body > .d-flex.gap-1:last-child,
.container.my-4 .card-body > .d-flex.gap-2:last-child {
    margin-top: 0.85rem;
    margin-bottom: 0.35rem;
}
.oe-tantargy-form .form-check-label.small {
    font-size: 0.875rem;
    line-height: 1.45;
    padding-left: 0.25rem;
}
.oe-tantargy-form .form-check {
    margin-bottom: 0.35rem;
}
.oe-tantargy-form input[type="number"] {
    max-width: 9rem;
}
.oe-tantargy-form textarea {
    line-height: 1.5;
}

/* Autosave indikátor */
.oe-tantargy-form #autosave-indicator {
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.oe-tantargy-form #autosave-indicator .bi {
    font-size: 1em;
}

/* =========================================================================
 * 14 hetes tematika tábla
 * ========================================================================= */
#tematika-tabla {
    margin-bottom: 0.75rem;
}
#tematika-tabla thead,
#tematika-tabla thead tr {
    background: #1f2937;
}
#tematika-tabla th {
    background: #1f2937;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.55rem 0.6rem;
    text-align: left;
    border-bottom: 2px solid var(--oe-primary, #00288C);
    letter-spacing: 0.01em;
}
#tematika-tabla td {
    padding: 0.35rem;
    vertical-align: middle;
}
#tematika-tabla input[type="text"] {
    font-size: 0.875rem;
}
#tematika-tabla .tematika-het {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
    text-align: center;
    font-weight: 500;
    background: #fafbfc;
}
#tematika-tabla .tematika-remove {
    padding: 0.125rem 0.5rem;
    line-height: 1;
}
#tematika-add-row {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* =========================================================================
 * Listázók (publikus + admin)
 * ========================================================================= */
.container > form.card.mb-3 .card-body {
    padding: 1rem;
}
.container > form.card .form-label.small.mb-1 {
    font-size: 0.78rem;
    color: #495057;
    margin-bottom: 0.2rem;
    font-weight: 500;
}
.container > form.card .form-control-sm,
.container > form.card .form-select-sm {
    font-size: 0.85rem;
}
.container > form.card .form-check-label.small {
    font-size: 0.825rem;
}
.container > form.card .col-md-12 {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e9ecef;
}

/* Táblázat-fejléc: erős kontraszt, jól látható, ikon-stabil */
.table.align-middle thead,
.table.align-middle thead tr,
.table.align-middle thead th {
    background: #1f2937;
    color: #fff;
}
.table.align-middle thead th {
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.65rem 0.85rem;
    line-height: 1.4;
    border-bottom: 2px solid var(--oe-primary, #00288C);
    white-space: nowrap;
    letter-spacing: 0.01em;
}
.table.align-middle thead th a,
.table.align-middle thead th a.text-decoration-none.text-reset,
.table.align-middle thead th a:visited {
    color: #fff !important;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    line-height: 1.4;
}
.table.align-middle thead th a:hover {
    color: #ffd54a !important;
}
.table.align-middle thead th .bi {
    font-size: 0.9em;
    color: #ffd54a;
    line-height: 1;
    flex-shrink: 0;
}
.table.align-middle tbody td {
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    vertical-align: middle;
}
.table.align-middle tbody code {
    font-size: 0.85rem;
    color: #495057;
    background: transparent;
    padding: 0;
}
.table.align-middle tbody a {
    color: var(--oe-primary-light, #1a3fa0);
    text-decoration: none;
}
.table.align-middle tbody a:hover {
    text-decoration: underline;
}

/* Akció-gombok a listázókon: keskeny gap-pel */
.table.align-middle .btn-sm {
    padding: 0.2rem 0.5rem;
    font-size: 0.825rem;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.table.align-middle .btn-sm .bi {
    font-size: 0.95em;
}

/* Badge-ek a listázókban és státusz-jelzéshez */
.badge {
    font-weight: 500;
    padding: 0.35em 0.6em;
    font-size: 0.78em;
    letter-spacing: 0.01em;
}
.badge.bg-warning,
.badge.bg-warning.text-dark {
    background-color: #ffc107 !important;
    color: #5b3d04 !important;
}

/* Talalat-szam */
.container > p.text-muted {
    font-size: 0.875rem;
    margin: 0.5rem 0 1rem;
}

/* =========================================================================
 * Nav tabs (Sajátok / Kari / Mind)
 * ========================================================================= */
.nav-tabs {
    border-bottom: 2px solid #dee2e6;
}
.nav-tabs .nav-link {
    color: #495057;
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.nav-tabs .nav-link:hover {
    color: var(--oe-primary, #00288C);
    border-color: transparent;
    background: transparent;
}
.nav-tabs .nav-link.active {
    color: var(--oe-primary, #00288C);
    background: transparent;
    border-bottom-color: var(--oe-primary, #00288C);
}

/* =========================================================================
 * Pagination - kompaktabb
 * ========================================================================= */
.pagination {
    margin-top: 1rem;
    margin-bottom: 0;
}
.pagination .page-link {
    padding: 0.35rem 0.7rem;
    font-size: 0.875rem;
    color: var(--oe-primary-light, #1a3fa0);
}
.pagination .page-item.active .page-link {
    background-color: var(--oe-primary, #00288C);
    border-color: var(--oe-primary, #00288C);
}

/* =========================================================================
 * Részletes nézet
 * ========================================================================= */
.container .row > .col-lg-8 {
    padding-right: 2rem;
}
.container .row > .col-lg-8 > h1 {
    margin-bottom: 0.3rem;
}
.container .row > .col-lg-8 > p.text-muted:first-of-type {
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
}
.container .row > .col-lg-8 > p.text-muted code {
    font-size: 0.95em;
    padding: 0.1em 0.4em;
    background: #f1f3f5;
    border-radius: 0.2em;
    color: #212529;
}
.container .row > .col-lg-8 > p.text-muted .badge {
    margin-left: 0.25rem;
}

.container .row > .col-lg-8 h2.h4 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
    color: var(--oe-primary, #00288C);
    font-weight: 600;
}
.container .row > .col-lg-8 h2.h4:first-of-type {
    margin-top: 1.5rem;
}
.container .row > .col-lg-8 h3.h5,
.container .row > .col-lg-8 h3.h6 {
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    color: #495057;
    font-weight: 500;
}
.container .row > .col-lg-8 .table-bordered.table-sm th,
.container .row > .col-lg-8 .table-bordered.table-sm td {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}
.container .row > .col-lg-8 .table-bordered.table-sm th {
    background: #e9ecef;
    color: #212529;
    font-weight: 600;
    width: 28%;
    border-color: #ced4da;
}
.container .row > .col-lg-8 .table-bordered.table-sm td {
    border-color: #ced4da;
}
.container .row > .col-lg-8 p {
    line-height: 1.65;
}

/* Sidebar (sticky) */
.container .row > aside.col-lg-4 {
    position: sticky;
    top: 1rem;
    align-self: flex-start;
}
aside.col-lg-4 .card {
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    box-shadow: var(--oe-card-shadow);
}
aside.col-lg-4 .card-header {
    background: var(--oe-primary, #00288C);
    color: #fff;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    border-bottom: 0;
}
aside.col-lg-4 .card-header strong {
    font-weight: 500;
}
aside.col-lg-4 .card-header .bi {
    margin-right: 0.35rem;
}
aside.col-lg-4 .card-body {
    padding: 1rem;
    font-size: 0.875rem;
}
aside.col-lg-4 .card-body hr {
    margin: 0.65rem 0;
    border-top-color: #e9ecef;
}
aside.col-lg-4 .form-label.small {
    font-size: 0.78rem;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
}
aside.col-lg-4 .card-footer {
    background: #fafbfc;
    border-top: 1px solid #e9ecef;
    padding: 0.85rem 1rem;
}
aside.col-lg-4 .card-footer .btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

aside.col-lg-4 .list-group-item {
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
}
aside.col-lg-4 .list-group-item .badge {
    margin-left: 0.15rem;
}
aside.col-lg-4 .list-group-item .btn-sm {
    padding: 0.15rem 0.45rem;
    font-size: 0.85rem;
}

aside.col-lg-4 ul.small {
    margin-bottom: 0;
}
aside.col-lg-4 ul.small li {
    margin-bottom: 0.5rem;
    line-height: 1.45;
}
aside.col-lg-4 ul.small li:last-child {
    margin-bottom: 0;
}
aside.col-lg-4 ul.small li code {
    font-size: 0.78rem;
    padding: 0.05em 0.35em;
    background: #f1f3f5;
    border-radius: 0.2em;
    color: #495057;
}

/* =========================================================================
 * Accordion (KKK kompetenciák a részletes nézeten)
 * ========================================================================= */
.accordion .accordion-item {
    border: 1px solid #dee2e6;
    margin-bottom: 0.25rem;
    border-radius: 0.375rem !important;
    overflow: hidden;
}
.accordion .accordion-button {
    padding: 0.75rem 1rem;
    background: #fafbfc;
    font-weight: 500;
    color: #212529;
    box-shadow: none;
}
.accordion .accordion-button:not(.collapsed) {
    background: #eef2f9;
    color: var(--oe-primary, #00288C);
    box-shadow: inset 0 -1px 0 #dee2e6;
}
.accordion .accordion-button:focus {
    border-color: var(--oe-primary-light, #1a3fa0);
    box-shadow: 0 0 0 0.15rem rgba(0, 40, 140, 0.15);
}
.accordion .accordion-button .badge {
    margin-left: auto;
    margin-right: 0.75rem;
}
.accordion .accordion-body {
    padding: 0.85rem 1.25rem;
    background: #fff;
}
.accordion .accordion-body ul {
    padding-left: 1.5rem;
}
.accordion .accordion-body li {
    line-height: 1.6;
    margin-bottom: 0.25rem;
}

/* =========================================================================
 * 14 hetes tematika (részletes nézeten)
 * ========================================================================= */
.col-lg-8 .table-responsive table.table-bordered.table-sm {
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
}
.col-lg-8 .table-responsive table.table-bordered.table-sm thead,
.col-lg-8 .table-responsive table.table-bordered.table-sm thead tr {
    background: #1f2937;
}
.col-lg-8 .table-responsive table.table-bordered.table-sm thead th {
    background: #1f2937;
    color: #fff;
    font-weight: 600;
    border-bottom: 2px solid var(--oe-primary, #00288C);
    padding: 0.6rem 0.75rem;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
}
.col-lg-8 .table-responsive table.table-bordered.table-sm td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    vertical-align: middle;
}
.col-lg-8 .table-responsive table.table-bordered.table-sm td code {
    display: inline-block;
    font-size: 0.85em;
    padding: 0.05em 0.35em;
    background: #f1f3f5;
    border-radius: 0.2em;
    color: #495057;
    min-width: 2rem;
    text-align: center;
}

/* =========================================================================
 * Modal-ok és gombok
 * ========================================================================= */
.modal-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0.85rem 1.25rem;
}
.modal-title {
    color: var(--oe-primary, #00288C);
    font-weight: 500;
    font-size: 1.1rem;
}
.modal-body {
    padding: 1.25rem;
    line-height: 1.6;
}
.modal-body .form-label {
    font-weight: 500;
    margin-top: 0.5rem;
}
.modal-footer {
    background: #fafbfc;
    border-top: 1px solid #dee2e6;
    padding: 0.85rem 1.25rem;
}
.modal-footer .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Gomb-igazítás: ikon + szöveg */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    justify-content: center;
    line-height: 1.5;
}
.btn .bi {
    font-size: 1em;
    line-height: 1;
}
.btn-sm {
    gap: 0.3rem;
}
.btn-lg {
    gap: 0.45rem;
}

/* Workflow-akciók gomb-csoport */
.d-flex.gap-1 .btn-sm,
.d-flex.gap-2 .btn-sm {
    white-space: nowrap;
}

/* =========================================================================
 * Alert-ek és figyelmeztetések
 * ========================================================================= */
.alert {
    padding: 0.85rem 1.25rem;
    margin-bottom: 1rem;
    border-radius: 0.375rem;
    line-height: 1.55;
}
.alert .bi {
    margin-right: 0.35rem;
    vertical-align: -1px;
}
.alert ul {
    margin-bottom: 0;
    padding-left: 1.5rem;
    margin-top: 0.35rem;
}
.alert ul li {
    margin-bottom: 0.2rem;
}
.alert strong + ul {
    margin-top: 0.5rem;
}
.alert-info {
    background-color: #eef2f9;
    border-color: #c7d2e8;
    color: #1a3fa0;
}
.alert-warning {
    background-color: #fff8e6;
    border-color: #ffd966;
    color: #7a5a00;
}
.alert-success {
    background-color: #e6f4ec;
    border-color: #b3d9c2;
    color: #145c2c;
}

/* =========================================================================
 * Reszponzív finomítások
 * ========================================================================= */
@media (max-width: 991.98px) {
    .container .row > aside.col-lg-4 {
        position: static;
        margin-top: 1.5rem;
    }
    .container .row > .col-lg-8 {
        padding-right: var(--bs-gutter-x, 0.75rem);
    }
}
@media (max-width: 767.98px) {
    .oe-tantargy-form .card-body {
        padding: 0.85rem;
    }
    #tematika-tabla input[type="text"] {
        font-size: 0.8rem;
        min-width: 4rem;
    }
    .table.align-middle thead th,
    .table.align-middle tbody td {
        padding: 0.45rem 0.5rem;
        font-size: 0.825rem;
    }
}

/* =========================================================================
 * Util osztályok
 * ========================================================================= */
.oe-uppercase-small {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.78rem;
    color: #6c757d;
    font-weight: 500;
}

/* Auto-flash bezárható alert kissé hangsúlyosabb close */
.alert-dismissible .btn-close {
    opacity: 0.5;
    padding: 0.85rem 1.25rem;
}
.alert-dismissible .btn-close:hover {
    opacity: 0.85;
}

/* =========================================================================
 * Mobil kártyanézet a listázó-tábláknak (.oe-cards-sm) - data-label alapján
 * Kis kijelzőn a sorok kártyákká alakulnak, a fejléc helyett a cellák
 * data-label attribútuma jelenik meg.
 * ========================================================================= */
@media (max-width: 767.98px) {
    table.oe-cards-sm thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
    table.oe-cards-sm,
    table.oe-cards-sm tbody,
    table.oe-cards-sm tr,
    table.oe-cards-sm td {
        display: block;
        width: 100%;
    }
    table.oe-cards-sm tr {
        margin-bottom: 0.85rem;
        border: 1px solid #dee2e6;
        border-radius: 0.375rem;
        padding: 0.35rem 0.65rem;
        box-shadow: var(--oe-card-shadow);
        background: #fff;
    }
    table.oe-cards-sm td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
        padding: 0.4rem 0.15rem;
        border: 0;
        border-bottom: 1px solid #f1f3f5;
        text-align: right;
        font-size: 0.875rem;
    }
    table.oe-cards-sm td:last-child {
        border-bottom: 0;
    }
    table.oe-cards-sm td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #495057;
        text-align: left;
        flex: 0 0 40%;
    }
    /* Striping kikapcsolása kártyanézetben (a kártya-háttér egységes) */
    table.oe-cards-sm.table-striped > tbody > tr:nth-of-type(odd) > td {
        background: transparent;
    }
}
