/* Main Layout Styles */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: var(--bs-body-font-family);
    font-size: var(--bs-body-font-size);
    font-weight: var(--bs-body-font-weight);
    line-height: var(--bs-body-line-height);
    color: var(--primary-color, #244197);
}

/* Profile Dropdown Styles */
#profileDropdown {
    transition: all 0.2s;
}

#profileDropdown:hover {
    opacity: 1;
}

#profileDropdown:hover .text-white,
#profileDropdown:hover .text-white-50 {
    color: white !important;
    opacity: 1;
}

#profileDropdown .rounded-circle {
    transition: transform 0.2s;
}

#profileDropdown:hover .rounded-circle {
    transform: scale(1.05);
}

.dropdown-menu {
    border: none;
    min-width: 280px;
}

.dropdown-item-text {
    padding: 0.75rem 1rem;
    background-color: #f8f9fa;
}

.dropdown-item:hover {
    color: white !important;
    background-color: var(--primary-color, #244197) !important;
}

.dropdown-item:hover i {
    color: white !important;
}

/* UDC Theme Customization - colors now dynamic from database */
.navbar.navbar-expand-lg.bg-body-tertiary,
.bg-body-tertiary {
  --bs-bg-opacity: 1 !important;
  background-color: var(--primary-color, #244197) !important;
  opacity: 1 !important;
}

/* Force navbar to be solid and opaque */
.navbar {
  background-color: var(--primary-color, #244197) !important;
  opacity: 1 !important;
}

/* Make login button visible on dark navbar */
.navbar .btn-outline-primary {
  color: white !important;
  border-color: white !important;
}

.navbar .btn-outline-primary:hover {
  background-color: white !important;
  color: var(--primary-color, #244197) !important;
  border-color: white !important;
}

/* Navbar positioning for fixed sidebar - only when sidebar exists */
@media (min-width: 992px) {
  .has-sidebar .navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1040;
    margin: 0 !important;
    border-left: none !important;
  }
  
  .has-sidebar .navbar .container-fluid {
    padding-left: calc(250px + 1rem); /* Start content after sidebar */
    padding-right: 1rem;
    margin: 0;
    max-width: 100%;
  }
}

[data-bs-theme="light"] {
  color-scheme: light;
  --bs-body-color: var(--primary-color, #244197);
  --bs-body-color-rgb: 36, 65, 151;
  --bs-body-bg: #f2f2f2;
  --bs-primary: var(--primary-color, #244197);
  --bs-primary-rgb: 36, 65, 151;
}

/* Breadcrumb styling - active items in primary color and bold */
.breadcrumb-item.active {
    color: var(--primary-color, #244197) !important;
    font-weight: bold;
}

/* Form text helper text in primary color */
.form-text {
  color: var(--primary-color, #244197) !important;
}

/* File upload button text color */
.form-control[type="file"]::file-selector-button {
  color: white !important;
  background-color: var(--primary-color, #244197) !important;
  border-color: var(--primary-color, #244197) !important;
}

.main-content {
    flex: 1 0 auto;
    padding: 0;
    margin: 0;
}

/* Center homepage content vertically when not logged in */
body:not(.has-sidebar) .main-content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px); /* Account for navbar and footer */
}

footer {
    flex-shrink: 0;
    margin-top: 20px;
    background-color: var(--primary-color, #244197);
    color: white;
}

/* Adjust footer for fixed sidebar on desktop - only when sidebar exists */
@media (min-width: 992px) {
    .has-sidebar footer {
        margin-left: 0;
        width: 100%;
        padding-left: 250px; /* Indent content to start after sidebar */
    }
}

/* Dashboard Sidebar Layout */
.dashboard-container {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    margin: 0;
    padding: 0;
}

.dashboard-sidebar {
    flex: 0 0 250px;
    background-color: #f8f9fa !important;
    border-right: 1px solid #dee2e6;
    height: 100vh; /* Full viewport height */
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    z-index: 1060;
    opacity: 1 !important;
    margin: 0;
    padding: 0;
}

.dashboard-content {
    flex: 1;
    padding: 20px;
    min-width: 0; /* Ensure content can shrink below min-content size */
}

/* Only apply sidebar spacing when sidebar exists */
@media (min-width: 992px) {
    .has-sidebar .dashboard-content {
        margin-left: 250px; /* Account for fixed sidebar */
        width: calc(100% - 250px);
        margin-top: 56px; /* Account for fixed navbar height */
    }
}

/* Sidebar Logo Section */
.sidebar-logo {
    padding: 8px 15px;
    border-bottom: 2px solid var(--bs-border-color);
    background-color: var(--primary-color, #244197);
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    height: 56px; /* Match navbar height */
    box-sizing: border-box;
}

.sidebar-logo:hover {
    color: white;
    opacity: 0.9;
}

.sidebar-logo img {
    height: 30px;
    width: auto;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav-item {
    border-bottom: 1px solid var(--bs-border-color);
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--bs-body-color);
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar-nav-link:hover {
    background-color: var(--primary-color, #244197);
    color: white;
}

.sidebar-nav-link.active {
    background-color: var(--primary-color, #244197);
    color: white;
    border-left: 3px solid white;
}

.sidebar-nav-icon {
    width: 20px;
    margin-right: 10px;
    text-align: center;
}

/* Grouped Collapsible Navigation Sections */
.sidebar-section {
    border-bottom: 1px solid var(--bs-border-color);
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 15px;
    background-color: rgba(0, 0, 0, 0.03);
    color: var(--bs-body-color);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.sidebar-section-header:hover {
    background-color: rgba(0, 0, 0, 0.06);
}

.sidebar-section-header .section-icon {
    width: 24px;
    margin-right: 10px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-section-header .chevron-icon {
    transition: transform 0.2s ease;
    font-size: 0.8rem;
}

.sidebar-section-header[aria-expanded="true"] .chevron-icon {
    transform: rotate(180deg);
}

.sidebar-section-content {
    background-color: rgba(0, 0, 0, 0.01);
}

.sidebar-section-content .sidebar-nav-link {
    padding-left: 50px;
    font-size: 0.9rem;
}

.sidebar-section-content .sidebar-nav-link .sidebar-nav-icon {
    width: 18px;
    font-size: 0.85rem;
}

/* Mobile Section Headers */
#mobileNavOffcanvas .sidebar-section-header {
    background-color: #f0f3f8;
    padding: 16px 20px;
}

#mobileNavOffcanvas .sidebar-section-header:hover {
    background-color: #e3e9f2;
}

#mobileNavOffcanvas .sidebar-section-content .nav-link {
    padding-left: 50px;
}

/* Responsive Sidebar */
@media (max-width: 991px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .dashboard-sidebar {
        display: none; /* Hide on mobile, use offcanvas instead */
    }
    
    .dashboard-content {
        width: 100%;
        margin-left: 0; /* No margin on mobile */
    }
}

/* Mobile Offcanvas Menu */
#mobileNavOffcanvas {
    width: 280px;
    background-color: #f8f9fa;
}

#mobileNavOffcanvas .offcanvas-header {
    background-color: var(--primary-color, #244197);
    padding: 20px;
}

#mobileNavOffcanvas .offcanvas-title {
    font-weight: 600;
    font-size: 1.25rem;
}

#mobileNavOffcanvas .offcanvas-body {
    padding: 0;
    background-color: #ffffff;
}

#mobileNavOffcanvas .mobile-nav {
    width: 100%;
    padding: 0;
    margin: 0;
}

#mobileNavOffcanvas .nav-item {
    border-bottom: 1px solid #e9ecef;
}

#mobileNavOffcanvas .nav-link {
    color: var(--primary-color, #244197);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    font-weight: 500;
}

#mobileNavOffcanvas .nav-link:hover {
    background-color: #f0f3f8;
    color: var(--primary-color, #244197);
    padding-left: 25px;
}

#mobileNavOffcanvas .nav-link.active {
    background-color: var(--primary-color, #244197);
    color: white;
    border-left: 4px solid #1a2f6f;
}

#mobileNavOffcanvas .nav-link i {
    width: 24px;
    text-align: center;
}

/* Navbar toggler button styling */
.navbar-toggler {
    border-color: rgba(255, 255, 255, 0.5);
}

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

/* Form Styles */
.form-section {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--bs-dark-border-subtle);
}

.form-section:last-child {
    border-bottom: none;
}

.file-preview {
    min-height: 50px;
}

.preview-image {
    max-width: 200px;
    max-height: 200px;
}

/* Card Styles */
.card {
    margin-bottom: 20px;
}

.card-header {
    font-weight: 500;
    background-color: var(--primary-color, #244197);
    color: white;
}

/* Dashboard Styles */
.stats-card {
    text-align: center;
    transition: transform 0.2s;
}

.stats-card:hover {
    transform: translateY(-5px);
}

.stats-value {
    font-size: 2rem;
    font-weight: 700;
}

.stats-label {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
}

.toggle-stats {
    cursor: pointer;
}

.stats-detail-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.stats-detail-section.show {
    max-height: 500px;
}

/* Member ID Card */
.id-card-container {
    max-width: 420px;
    margin: 0 auto;
}

.id-card {
    border: 1px solid var(--bs-dark-border-subtle);
    padding: 10px;
    background: var(--bs-light);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.id-card img {
    max-width: 100%;
    border-radius: 5px;
}

/* Poll Styles */
.poll-option {
    margin-bottom: 10px;
}

.poll-result-bar {
    height: 24px;
    margin-top: 5px;
    position: relative;
}

.poll-result-value {
    position: absolute;
    right: 10px;
    top: 0;
    color: var(--bs-light);
    font-weight: 600;
    line-height: 24px;
}

/* Forum Styles */
.forum-post {
    border-left: 3px solid var(--primary-color, #244197);
    padding-left: 15px;
}

.forum-response {
    border-left: 3px solid var(--bs-secondary);
    padding-left: 15px;
    margin-left: 30px;
}

.official-response {
    border-left-color: var(--primary-color, #244197);
}

.forum-author-avatar {
    width: 7%; /* Profile picture width reduced to 7% as requested */
    max-width: 45px; /* Maximum width for larger screens, reduced to match 7% */
}

.forum-post-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

/* Project Styles */
.project-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.status-ongoing {
    background-color: var(--bs-warning-bg-subtle);
    color: var(--bs-warning-text);
}

.status-completed {
    background-color: var(--primary-color, #244197);
    color: white;
}

.status-stalled {
    background-color: var(--bs-danger-bg-subtle);
    color: var(--bs-danger-text);
}

.project-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.project-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 5px;
}

/* Discipline Case Styles */
.discipline-warning {
    border-left-color: var(--primary-color, #244197);
}

.discipline-suspension {
    border-left-color: var(--bs-danger);
}

.discipline-expulsion {
    border-left-color: var(--bs-dark);
}

.case-pending {
    background-color: var(--bs-warning-bg-subtle);
}

.case-reviewed {
    background-color: var(--primary-color, #244197);
    color: white;
}

.case-actioned {
    background-color: var(--bs-danger-bg-subtle);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .stats-card {
        margin-bottom: 15px;
    }
    
    .forum-response {
        margin-left: 15px;
    }
    
    /* Fix for mobile menu */
    #mobileNavMenu {
        max-height: 85vh; /* Allow more space on mobile */
    }
    
    #mobileNavMenu .container {
        padding-bottom: 60px; /* More bottom padding for scrolling */
    }
    
    #mobileNavMenu .mobile-nav {
        max-height: 80vh;
        overflow-y: auto !important;
        padding-bottom: 75px; /* Extra bottom padding */
    }
}

/* Notification Styles */
.unread-notification {
    background-color: rgba(36, 65, 151, 0.1);
    position: relative;
}

.unread-notification::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 5px;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--primary-color, #244197);
}

.notification-item {
    transition: background-color 0.3s ease;
}

.notification-item:hover {
    background-color: rgba(36, 65, 151, 0.1);
}

.smaller {
    font-size: 0.75rem;
}

/* Add notification badge styling */
#notificationDropdown .badge {
    transition: all 0.3s ease;
}

/* Make notification icon white */
.me-3 {
    color: white;
}

/* Update primary button colors */
.btn-primary {
    background-color: var(--primary-color, #244197);
    border-color: var(--primary-color, #244197);
}

.btn-primary:hover {
    background-color: #1a3179;
    border-color: #1a3179;
}

.btn-outline-primary {
    color: var(--primary-color, #244197);
    border-color: var(--primary-color, #244197);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color, #244197);
    border-color: var(--primary-color, #244197);
    color: white;
}

.badge.bg-primary {
    background-color: var(--primary-color, #244197) !important;
}

a {
    color: var(--primary-color, #244197);
}

a:hover {
    color: #1a3179;
}

/* UDC additional styles for colors */
.text-muted {
    color: var(--primary-color, #244197) !important;
}

.bg-body-tertiary {
    background-color: var(--primary-color, #244197) !important;
}

/* Success color update */
.text-success, 
.bg-success {
    color: rgb(0, 145, 24) !important;
}

.bg-success {
    background-color: rgb(0, 145, 24) !important;
}

/* Sidebar starts from top */
.dashboard-sidebar {
    top: 0 !important;
}

/* Additional fixes for padding and colors */
.main-content {
    padding-top: 0; /* Remove top padding */
}

/* Fix for bg-success text */
.bg-success {
    color: white !important;
}

/* Stats value and label color */
.stats-value, .stats-label {
    color: white !important;
}

/* Increase card shadow */
.card {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important; /* Increased shadow */
}

/* Remove padding between navbar and sidebar */
.dashboard-sidebar {
    margin-top: 0;
    padding-top: 0;
}

body {
    padding-top: 0;
    margin-top: 0;
}

.navbar {
    margin-bottom: 0;
}

.dashboard-container {
    margin-top: 0;
    padding-top: 0;
}
/* UDC Blue Breadcrumb Separator */
.breadcrumb-item::before {
    color: var(--primary-color, #244197) !important; /* UDC blue */
}

/* Placeholder color for forms */
::placeholder,
input::placeholder,
.form-control::placeholder {
    color: var(--primary-color, #244197) !important;
    opacity: 1 !important;
}


/* Placeholder color for forms */
::placeholder,
input::placeholder,
.form-control::placeholder {
    color: var(--primary-color, #244197) !important;
    opacity: 1 !important;
}


/* Fix for project details labels - make text-muted white for better contrast */
.card.bg-body-tertiary .text-muted {
    color: #ffffff !important;
}


/* Fix for member profile details card - label text on bg-body-tertiary */
.card .card-header.bg-body-tertiary + .card-body strong,
.card .card-header.bg-body-tertiary + .card-body p strong {
    color: #ffffff !important;
}

/* Make member profile labels white */
.bg-body-tertiary, 
.bg-body-tertiary h5 {
    color: #ffffff !important;
}


/* Documentation links are now visible in all menus */

/* ========================================
   Flash Messages Styling
   ======================================== */

/* Flash messages container - fixed position at top */
.flash-messages-container {
    position: fixed;
    top: 70px; /* Below navbar */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050; /* Above most content */
    width: 90%;
    max-width: 800px;
    pointer-events: none; /* Allow clicking through container */
}

.flash-messages-container .flash-message {
    pointer-events: auto; /* But allow clicking the messages */
    margin-bottom: 15px;
    animation: slideDown 0.3s ease-out;
}

/* Flash message animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Flash message fade out animation */
@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

.flash-message.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

/* Flash message styles */
.flash-message {
    border-left: 4px solid;
    border-radius: 6px;
    padding: 16px 20px;
    font-size: 15px;
    line-height: 1.6;
}

/* Flash message title */
.flash-title {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

/* Flash message text */
.flash-message-text {
    font-size: 14px;
    line-height: 1.5;
}

/* Flash message icon sizing */
.flash-icon {
    font-size: 22px;
    flex-shrink: 0;
}

/* Success message styling */
.alert-success.flash-message {
    background-color: #d1e7dd;
    border-left-color: #0f5132;
    color: #0f5132;
}

.alert-success .flash-icon {
    color: #198754;
}

/* Error/Danger message styling */
.alert-danger.flash-message {
    background-color: #f8d7da;
    border-left-color: #842029;
    color: #842029;
}

.alert-danger .flash-icon {
    color: #dc3545;
}

/* Warning message styling */
.alert-warning.flash-message {
    background-color: #fff3cd;
    border-left-color: #664d03;
    color: #664d03;
}

.alert-warning .flash-icon {
    color: #ffc107;
}

/* Info message styling */
.alert-info.flash-message {
    background-color: #cff4fc;
    border-left-color: #055160;
    color: #055160;
}

.alert-info .flash-icon {
    color: #0dcaf0;
}

/* Close button styling for flash messages */
.flash-message .btn-close {
    opacity: 0.5;
    padding: 0.5rem;
}

.flash-message .btn-close:hover {
    opacity: 1;
}

/* Responsive flash messages */
@media (max-width: 768px) {
    .flash-messages-container {
        top: 60px;
        width: 95%;
        padding: 0 10px;
    }
    
    .flash-message {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .flash-title {
        font-size: 15px;
    }
    
    .flash-message-text {
        font-size: 13px;
    }
    
    .flash-icon {
        font-size: 20px;
    }
}

/* Ensure flash messages work with scrolling */
@media (max-width: 991px) {
    .flash-messages-container {
        position: relative;
        top: 0;
        left: 0;
        transform: none;
        width: 100%;
        max-width: 100%;
        margin-bottom: 20px;
        padding: 0 15px;
    }
}
