/* =====================================================
   AFJU — Bootstrap 5 complementary styles
   ===================================================== */

/* Variables */
:root {
    --afju-navy:        #1b3a6b;
    --afju-blue:        #2563eb;
    --afju-light-blue:  #dbeafe;
    --afju-bg:          #f0f2f5;
    --afju-card-shadow: 0 2px 8px rgba(0,0,0,.08);
}

/* Base */
body {
    background: var(--afju-bg);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.9rem;
    color: #374151;
}

h1 { color: var(--afju-navy); font-size: 1.6rem; margin-bottom: 1rem; }
h2 { color: var(--afju-navy); font-size: 1.3rem; margin-bottom: 0.75rem; }
h3 { color: var(--afju-navy); font-size: 1.1rem; margin-bottom: 0.5rem; }

/* ── Navbar ── */
.afju-navbar {
    background-color: #4caf50 !important;
    box-shadow: 0 2px 6px rgba(0,0,0,.20);
}

.afju-navbar .navbar-brand {
    color: #fff !important;
    font-weight: 700;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.afju-navbar .navbar-brand span {
    color: #fff;
}

.afju-navbar .nav-link {
    color: rgba(255,255,255,.85) !important;
    font-size: 0.88rem;
    padding: 0.45rem 0.65rem;
    border-radius: 4px;
    transition: background .15s;
}

.afju-navbar .nav-link:hover,
.afju-navbar .nav-link.active {
    color: #fff !important;
    background: rgba(255,255,255,.12);
}

.afju-navbar .navbar-toggler {
    border-color: rgba(255,255,255,.4);
}

.afju-navbar .navbar-toggler-icon {
    filter: invert(1);
}

/* User dropdown in navbar */
.afju-navbar .dropdown-toggle {
    color: rgba(255,255,255,.85) !important;
    font-size: 0.88rem;
}

.afju-navbar .dropdown-menu {
    background: #fff;
    border: 1px solid #dee2e6;
    min-width: 200px;
}

.afju-navbar .dropdown-item:hover {
    background: var(--afju-light-blue);
    color: var(--afju-navy);
}

.afju-navbar .dropdown-item.text-danger {
    color: #dc3545;
}

.afju-navbar .dropdown-item.text-danger:hover {
    background: #f8d7da;
    color: #842029;
}

/* ── Breadcrumbs ── */
.afju-breadcrumbs-wrap {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

div.breadcrumbs {
    font-size: 0.85rem;
    padding: 0.45rem 0;
    background: transparent;
}

div.breadcrumbs .breadcrumb {
    background: transparent;
    margin: 0;
    padding: 0;
}

div.breadcrumbs a {
    color: var(--afju-navy);
    text-decoration: none;
}

div.breadcrumbs a:hover {
    text-decoration: underline;
}

div.breadcrumbs span {
    font-weight: 600;
    color: var(--afju-navy);
}

/* ── Flash messages ── */
div.flash-success {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 0.5rem;
}

div.flash-error {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 0.5rem;
}

div.flash-notice {
    background: #fff3cd;
    color: #664d03;
    border: 1px solid #ffecb5;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 0.5rem;
}

/* ── Page container ── */
.afju-page-container {
    padding-top: 0.5rem;
    padding-bottom: 2rem;
}

/* ── Content & Sidebar ── */
#content {
    padding: 1.25rem 1rem;
}

#sidebar {
    padding: 1rem 0 1rem 1rem;
}

@media (max-width: 991.98px) {
    #sidebar {
        padding: 1rem 0 0 0;
    }
}

/* ── Portlet / Sidebar card ── */
.portlet {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: var(--afju-card-shadow);
}

.portlet-decoration {
    background: var(--afju-navy);
    padding: 0.45rem 0.8rem;
    border-left: 4px solid var(--afju-blue);
}

.portlet-title {
    font-size: 0.82rem;
    font-weight: 700;
    margin: 0;
    padding: 0;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.portlet-content {
    padding: 0.6rem 0.8rem;
    background: #fff;
}

.portlet-content ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.portlet-content li {
    padding: 2px 0;
}

/* ── Operations (sidebar menu) ── */
.operations {
    list-style: none;
    margin: 0;
    padding: 0;
}

.operations li {
    padding-bottom: 2px;
}

.operations li a {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--afju-navy);
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    text-decoration: none;
    transition: background .15s;
}

.operations li a:visited {
    color: var(--afju-navy);
}

.operations li a:hover {
    background: var(--afju-light-blue);
    color: var(--afju-blue);
}

/* ── GridView / table.items ── */
.grid-view {
    overflow-x: auto;
}

table.items {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
}

table.items thead th {
    background: var(--afju-navy);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.55rem 0.75rem;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

table.items thead th a {
    color: #fff;
    text-decoration: none;
}

table.items thead th a:hover {
    color: var(--afju-light-blue);
}

table.items tr.odd td {
    background: #fff;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

table.items tr.even td {
    background: #f8fafc;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

table.items tr:hover td {
    background: var(--afju-light-blue);
}

/* Button column badges */
table.items .button-column a {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    margin: 0 1px;
    transition: opacity .15s;
}

table.items .button-column a:hover {
    opacity: 0.82;
}

/* view = blue, update = yellow/dark, delete = red */
table.items .button-column a[href*="/view"],
table.items .button-column a.view-btn {
    background: var(--afju-blue);
    color: #fff;
}

table.items .button-column a[href*="/update"],
table.items .button-column a.update-btn {
    background: #d97706;
    color: #fff;
}

table.items .button-column a[href*="/delete"],
table.items .button-column a.delete-btn {
    background: #dc3545;
    color: #fff;
}

/* GridView pager */
.grid-view .pager {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0.25rem 0;
    gap: 4px;
    flex-wrap: wrap;
}

.grid-view .pager li a,
.grid-view .pager li span {
    display: inline-block;
    padding: 0.3rem 0.65rem;
    font-size: 0.82rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: var(--afju-blue);
    background: #fff;
    text-decoration: none;
    transition: background .15s;
}

.grid-view .pager li.selected a,
.grid-view .pager li.selected span,
.grid-view .pager li a:hover {
    background: var(--afju-blue);
    color: #fff;
    border-color: var(--afju-blue);
}

.grid-view .pager li.hidden a {
    color: #adb5bd;
    cursor: default;
}

/* GridView summary */
.grid-view .summary {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.4rem;
}

/* ── DetailView table ── */
table.detail-view {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
}

table.detail-view th {
    background: #f1f5f9;
    color: #374151;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    width: 30%;
    vertical-align: top;
}

table.detail-view td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    vertical-align: top;
}

table.detail-view tr:nth-child(even) td {
    background: #f8fafc;
}

/* ── Search form ── */
div.search-form {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin: 0.75rem 0 1rem 0;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

a.search-button {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #495057;
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 5px;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s;
}

a.search-button:hover {
    background: #dee2e6;
    color: #212529;
}

/* ── View card ── */
div.view {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 0.75rem 0;
    box-shadow: 0 1px 6px rgba(0,0,0,.07);
}

/* ── Login page ── */
.afju-login-wrap {
    max-width: 400px;
    margin: 3rem auto 2rem;
    padding: 0 1rem;
}

.afju-login-wrap div.form {
    max-width: 100%;
}

#login-form {
    max-width: 400px;
    margin: 0 auto;
}

/* ── Footer ── */
#footer {
    padding: 0.75rem 1rem;
    font-size: 0.78rem;
    color: #6c757d;
    text-align: center;
    border-top: 1px solid #dee2e6;
    margin-top: 1.5rem;
}

/* ── Print ── */
@media print {
    .afju-navbar,
    #sidebar,
    .afju-breadcrumbs-wrap,
    #footer {
        display: none !important;
    }

    body {
        background: #fff;
        font-size: 0.85rem;
        color: #000;
    }

    #content {
        padding: 0;
    }

    table.items,
    table.detail-view {
        border: 1px solid #999;
    }

    table.items thead th {
        background: #333 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
