:root {
    --fbs-primary: #0d47a1;
    --fbs-accent: #1565c0;
    --fbs-surface: #f4f7fb;
}

html {
    position: relative;
    min-height: 100%;
}

body {
    background-color: var(--fbs-surface);
    margin-bottom: 60px;
}

.navbar-brand {
    letter-spacing: 0.02em;
}

.card {
    border: none;
    box-shadow: 0 0.125rem 0.5rem rgba(13, 71, 161, 0.08);
}

.card-stat {
    border-left: 4px solid var(--fbs-primary);
}

.card-stat .stat-icon {
    font-size: 2rem;
    color: var(--fbs-accent);
    opacity: 0.85;
}

.hero-section {
    background: linear-gradient(135deg, #0d47a1 0%, #1976d2 100%);
    color: #fff;
    border-radius: 0.75rem;
    padding: 2.5rem 2rem;
    margin-bottom: 2rem;
}

.hero-section .btn-light {
    font-weight: 500;
}

.table-responsive {
    background: #fff;
    border-radius: 0.5rem;
    padding: 0.25rem;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.program-items-toolbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    padding: 0.75rem 0;
    margin-bottom: 0.25rem;
    background: linear-gradient(to bottom, #eef1f5 70%, rgba(238, 241, 245, 0));
}

.program-items-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.program-item-row {
    border-radius: 0.5rem;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-left-width: 4px;
    transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

.program-item-row--new-panel {
    background: #ffffff;
    border: 2px solid #0d6efd;
    border-left-width: 4px;
    box-shadow: 0 0.25rem 0.75rem rgba(13, 110, 253, 0.12);
}

.program-item-row--inline-edit {
    margin-bottom: 0;
}

.program-item-card--editing {
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.35);
}

.program-item-card {
    border-radius: 0.5rem;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-left-width: 4px;
}

.program-item-card--a {
    background: #ffffff;
    border-left-color: #0d6efd;
    border-color: #c5d4e8;
}

.program-item-card--b {
    background: #f0f7f4;
    border-left-color: #198754;
    border-color: #b8d4c8;
}

.program-item-select {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
}

#program-items-bulk-toolbar {
    padding: 0.5rem 0.75rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
}

.login-card {
    max-width: 420px;
    margin: 2rem auto;
}

.badge-status {
    font-weight: 500;
}

.portal-card {
    transition: transform 0.15s, box-shadow 0.15s;
}

.portal-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(13, 71, 161, 0.12);
}

.portal-icon {
    font-size: 2.5rem;
}

.project-card {
    transition: box-shadow 0.15s;
    overflow: hidden;
}

.project-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12);
}

.project-cover,
.project-cover-placeholder {
    height: 240px;
    object-fit: cover;
}

.project-cover-placeholder {
    min-height: 240px;
}

.project-gallery-img {
    max-height: 520px;
    min-height: 220px;
    object-fit: cover;
}

.portfolio-hero-cover {
    max-height: 400px;
    object-fit: cover;
}

.gallery-trigger {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: zoom-in;
    text-align: inherit;
}

.gallery-trigger:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.gallery-trigger .project-gallery-img,
.gallery-trigger .portfolio-hero-cover {
    width: 100%;
    transition: opacity 0.15s ease;
}

.gallery-trigger:hover .project-gallery-img,
.gallery-trigger:hover .portfolio-hero-cover {
    opacity: 0.92;
}

body.image-gallery-open {
    overflow: hidden;
}

.image-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-gallery-lightbox[hidden] {
    display: none !important;
}

.image-gallery-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    cursor: zoom-out;
}

.image-gallery-panel {
    position: relative;
    z-index: 1;
    width: min(96vw, 1200px);
    max-height: 96vh;
    padding: 0 3.5rem;
    pointer-events: none;
}

.image-gallery-figure {
    margin: 0;
    pointer-events: auto;
    text-align: center;
}

.image-gallery-img {
    display: block;
    max-width: 100%;
    max-height: calc(96vh - 5rem);
    margin: 0 auto;
    object-fit: contain;
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.45);
}

.image-gallery-caption {
    color: #f8f9fa;
    margin-top: 0.75rem;
    font-size: 0.95rem;
}

.image-gallery-counter {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
    margin-top: 0.35rem;
}

.image-gallery-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    z-index: 2;
    pointer-events: auto;
}

.image-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 2.75rem;
    height: 2.75rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #212529;
    font-size: 1.35rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 0.15rem 0.5rem rgba(0, 0, 0, 0.25);
}

.image-gallery-nav:hover:not(:disabled) {
    background: #fff;
}

.image-gallery-nav:disabled {
    opacity: 0.35;
    cursor: default;
}

.image-gallery-prev {
    left: 0;
}

.image-gallery-next {
    right: 0;
}

@media (max-width: 576px) {
    .image-gallery-panel {
        padding: 0 2.75rem;
    }

    .image-gallery-nav {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 1.1rem;
    }

    .image-gallery-close {
        top: -2.25rem;
    }
}

@media (max-width: 576px) {
    .page-header h1 {
        font-size: 1.35rem;
    }

    .hero-section {
        padding: 1.5rem 1rem;
    }
}

/* Admin entity forms */
.admin-form {
    overflow: hidden;
}

.admin-form-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #0d47a1 0%, #1976d2 100%);
    color: #fff;
}

.admin-form-header-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.admin-form-section {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.admin-form-section:last-of-type {
    border-bottom: none;
}

.admin-form-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--fbs-primary);
    margin-bottom: 1rem;
}

.admin-form-section-title i {
    opacity: 0.85;
}

.admin-form-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: #f8f9fb;
    border-top: 1px solid #e9ecef;
}

.admin-form .input-group-text {
    background: #fff;
    color: #6c757d;
}

.admin-form-status-card {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.85rem 1rem;
    background: #fff;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.project-document-folder-card .card:hover {
    box-shadow: 0 0.25rem 0.75rem rgba(13, 71, 161, 0.12);
}

.project-document-folder-icon {
    line-height: 1;
}

.rich-text-content {
    line-height: 1.65;
    word-wrap: break-word;
}

.rich-text-content p:last-child,
.rich-text-content ul:last-child,
.rich-text-content ol:last-child {
    margin-bottom: 0;
}

.rich-text-content h2,
.rich-text-content h3,
.rich-text-content h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.rich-text-content ul,
.rich-text-content ol {
    padding-left: 1.25rem;
}

.rich-text-content blockquote {
    border-left: 3px solid rgba(13, 71, 161, 0.35);
    margin: 0.75rem 0;
    padding: 0.25rem 0 0.25rem 1rem;
    color: #495057;
}

.rich-text-content a {
    word-break: break-word;
}
