/* 
 * JSL Biblioteca Styles
 */

/* General Styles */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image: url('../img/background.png');
    background-repeat: repeat;
    background-attachment: fixed;
    background-position: center;
    background-size: cover;
}

/* Ensure main content area takes up available space to push footer down */
body > .container.mt-4 {
    flex: 1 0 auto;
}

/* Content container with glass effect */
.container {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 0.5rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    position: relative;
    z-index: 1;
}

/* Main content containers should have lower z-index than dropdowns */
.container:not(.navbar .container) {
    z-index: 1;
}

/* Ensure content never overlaps dropdown */
.mt-4.container {
    z-index: 1 !important;
}

/* Fix for Chrome */
body {
    transform: translateZ(0);
}

.navbar {
    position: relative;
    z-index: 1050 !important;
}

/* Exception for navbar container */
.navbar .container {
    background-color: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    margin-top: 0;
    margin-bottom: 0;
    position: relative;
}

/* Make sure navbar elements have the proper stacking context */
.navbar-nav, 
.d-flex,
.dropdown-toggle {
    position: relative;
    z-index: 1050;
}

footer {
    margin-top: auto;
    background: #EAEAEA !important; /* Light gray background */
    padding: 0.35rem 0;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
    font-size: 0.8rem;
    width: 100%;
    position: relative;
    bottom: 0;
}

footer p {
    margin-bottom: 0;
    font-weight: 500;
    color: #0F1940 !important;
}

/* Ensure all footer text is blue regardless of language */
footer span, 
footer #footerRights,
footer #currentYear,
footer p.footer-text,
footer .container * {
    color: #0F1940 !important;
}

.footer-link {
    color: #0F1940 !important;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #F4AA1C;
    text-decoration: underline;
}

/* Card Styles */
.card {
    transition: transform 0.3s, box-shadow 0.3s;
    margin-bottom: 1.5rem;
    border-radius: 0.375rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-bottom: 3px solid #F4AA1C;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background-color: #0F1940;
    border-color: #0F1940;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: #1a2559;
    border-color: #1a2559;
}

.btn-outline-primary {
    color: #0F1940;
    border-color: #0F1940;
}

.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active {
    background-color: #0F1940;
    border-color: #0F1940;
}

.badge.bg-primary {
    background-color: #0F1940 !important;
}

.badge.bg-warning {
    background-color: #F4AA1C !important;
}

.text-primary {
    color: #0F1940 !important;
}

.text-warning {
    color: #F4AA1C !important;
}

/* Pagination Styles */
.pagination-wrapper {
    font-size: 0.85rem;
}

.pagination-info {
    color: #6c757d;
    white-space: nowrap;
}

.pagination-buttons .btn {
    padding: 0.25rem 0.5rem;
    border-color: #0F1940;
    color: #0F1940;
}

.pagination-buttons .btn:hover {
    background-color: #0F1940;
    color: white;
}

.pagination-buttons .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#itemsPerPage {
    border-color: #0F1940;
    color: #0F1940;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    height: auto;
    /* Remove the dropdown arrow indicator */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: none;
    padding-right: 0.5rem;
}

/* Add a custom dropdown indicator that we can control */
.select-wrapper {
    position: relative;
    display: inline-block;
}

.select-wrapper::after {
    content: '\F282'; /* Bootstrap icon chevron-down */
    font-family: 'bootstrap-icons';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #0F1940;
    pointer-events: none;
    font-size: 12px;
}

/* Hide default dropdown arrow in IE10/11 */
select::-ms-expand {
    display: none;
}

/* Ensure the dropdown has consistent padding */
.select-wrapper select {
    text-align: center;
    min-width: 60px;
}

/* Search Styles */
#searchInput,
#familySearchInput {
    border-color: #0F1940;
    box-shadow: none;
    height: 38px;
}

#searchInput:focus,
#familySearchInput:focus {
    box-shadow: 0 0 0 0.1rem rgba(15, 25, 64, 0.25);
}

#searchButton,
#familySearchButton {
    background-color: #f8f9fa;
    border-color: #ced4da;
    color: #0F1940;
}

#clearSearchButton {
    background-color: #f8f9fa;
    border-color: #ced4da;
    color: #0F1940;
}

#clearFamilySearchButton {
    border-color: #0F1940;
    color: #0F1940;
}

#clearFamilySearchButton:hover {
    background-color: #f8f9fa;
}

#clearSearchButton:hover {
    background-color: #e2e6ea;
    border-color: #dae0e5;
}

#searchAndPaginationControls {
    margin-bottom: 1.5rem;
}

/* Document Item Styles */
.document-item .card-header {
    padding: 0.75rem 1rem;
}

.document-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    #white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-categories {
    font-size: 0.8rem;
    line-height: 1.2;
}

.document-thumbnail-container {
    height: 210px;
    position: relative;
    background-color: #f8f9fa;
    overflow: hidden;
    margin-bottom: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.document-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform 0.3s ease;
}

.document-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    padding: 1rem;
    background-color: #f8f9fa;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.document-thumbnail-container:hover .document-icon {
    transform: scale(1.05);
    background-color: #e9ecef;
}

.document-thumbnail-container:hover .document-thumbnail {
    transform: scale(1.05);
}

.document-thumbnail-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to top, rgba(248, 249, 250, 1), rgba(248, 249, 250, 0));
    pointer-events: none;
}

.document-item .card-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.document-info .badge {
    font-size: 0.7rem;
    font-weight: 500;
}

.document-actions .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.document-actions .download-btn {
    padding: 0.25rem 0.35rem;
}

/* Badge Styles */
.badge {
    font-weight: 500;
}

/* Document Viewer Styles */
#pdfViewerFrame {
    border: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

#imageViewerImg {
    max-height: 80vh;
    margin: 0 auto;
}

/* Breadcrumb Styles */
.breadcrumb {
    background-color: #f8f9fa;
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    margin-bottom: 1.5rem;
}

/* Language Dropdown Styles */
.language-dropdown-container {
    position: relative;
    z-index: 9999 !important; /* Extremely high z-index */
}

/* Standard Bootstrap dropdown styles */
.dropdown-menu {
    min-width: 10rem;
    z-index: 9999 !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175) !important;
    background-color: white !important;
}

.language-option {
    cursor: pointer;
    transition: background-color 0.2s ease !important;
}

.language-option:hover {
    background-color: #f8f9fa !important;
}

/* Ensure language dropdown links are visible and clickable */
.dropdown-menu a.language-option {
    padding: 0.5rem 1rem !important;
    display: block !important;
    width: 100% !important;
    text-align: left !important;
    color: #212529 !important;
    text-decoration: none !important;
}

.dropdown-menu a.language-option:hover {
    background-color: #f8f9fa !important;
    color: #0F1940 !important;
}

/* Override any Bootstrap styles that might interfere */
.dropdown-menu {
    z-index: 9999 !important;
}

.dropdown {
    position: relative !important;
    z-index: 9999 !important;
}

/* Group and Family List Styles */
.list-group-item {
    transition: all 0.2s ease;
}

.list-group-item:hover {
    background-color: #0F1940;
    color: #F4AA1C;
}

.list-group-item.active {
    background-color: #F4AA1C !important;
    border-color: #F4AA1C !important;
    color: #0F1940 !important;
    font-weight: 600;
}

/* Navbar enhancements */
.navbar {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: rgba(15, 25, 64, 0.9) !important;
    backdrop-filter: blur(5px);
}

.navbar-brand {
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
}

.navbar-brand img,
.nav-logo {
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-height: 30px;
}

.navbar-brand:hover img {
    transform: scale(1.05);
}

/* Bootstrap dropdown fixes */
.dropdown-menu.show {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    z-index: 1050 !important;
    position: absolute !important;
}

/* Ensure dropdown buttons work properly */
button.dropdown-toggle:focus + .dropdown-menu,
button.dropdown-toggle:active + .dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .document-thumbnail-container {
        height: 200px;
    }
    
    .document-icon i {
        font-size: 4rem !important;
    }
    
    #pdfViewerFrame {
        height: 500px !important;
    }
    
    .document-actions {
        display: flex;
    }
    
    .document-title {
        font-size: 0.95rem;
    }
}

@media (max-width: 576px) {
    .document-thumbnail-container {
        height: 180px;
    }
    
    .document-icon i {
        font-size: 3.5rem !important;
    }
    
    #pdfViewerFrame {
        height: 400px !important;
    }
    
    .document-info .badge {
        font-size: 0.65rem;
    }
    
    .document-actions .btn {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
    
    .document-title {
        font-size: 0.9rem;
    }
}
