/* Banyan Tree Village Custom CSS */

/* Root Variables: Define primary colors and values used throughout the site
   Using CSS variables allows for easy theme changes and consistency */
:root {
  --bs-primary: #a3e0e3 !important;      /* Main theme color - Light blue */
  --bs-primary-rgb: 163, 224, 227 !important;  /* RGB values for opacity/alpha variations */
  --bs-white: #fffffc !important;        /* Custom off-white for better readability */
  --bs-white-rgb: 255, 255, 252 !important;
  --bs-body-bg: #fffffc !important;      /* Page background color */
  --bs-secondary: #6c757d;               /* Secondary gray color */
  --bs-success: #198754;                 /* Success state color - Green */
  --bs-danger: #dc3545;                  /* Danger/error state color - Red */
  --bs-warning: #ffc107;                 /* Warning state color - Yellow */
  --bs-info: #0dcaf0;                    /* Info state color - Cyan */
  --bs-nav-link-color: #3d3333;          /* Navigation link color */
  --bs-nav-link-hover-bg: rgba(61, 51, 51, 0.1); /* Navigation hover background */
}

/* Button Styling: Override Bootstrap's default button styles */
.btn-primary {
  background-color: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
}

/* Outline Button Styling: For secondary action buttons */
.btn-outline-primary {
  color: #3d3333 !important;
  border-color: #3d3333 !important;
}

/* Hover/Focus States: Interactive states for outline buttons */
.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
  background-color: var(--bs-primary) !important;
  color: #fff !important;
}

/* Background and Text Color Utilities */
.bg-primary { background-color: var(--bs-primary) !important; }
.text-primary { color: var(--bs-primary) !important; }
.border-primary { border-color: var(--bs-primary) !important; }

/* Link Styling */
a {
  color: var(--bs-primary);
}

a:hover {
  color: #8bc2c2;  /* Darker shade for hover state */
}

/* Badge Styling: For status indicators and tags */
.badge.bg-primary {
  background-color: var(--bs-primary) !important;
}

/* Dropdown Menu Styling */
.dropdown-item.active, 
.dropdown-item:active {
  background-color: var(--bs-primary) !important;
}

/* Pagination Controls */
.page-link {
  color: var(--bs-primary) !important;
}

.page-item.active .page-link {
  background-color: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
  color: #fff !important;
}

/* Hero Section: Main banner area with background image */
.hero-section {
    background: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)), 
                url('/static/images/banyan-tree-grounds.jpg') center/cover no-repeat;
    position: relative;
}

/* Global Layout and Typography */
body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #212529;
    min-height: 100vh;  /* Ensures full viewport height */
    display: flex;
    flex-direction: column;  /* Enables footer to stick to bottom */
    background-color: var(--bs-white);
}

/* Component Background Colors: Ensure consistent background across components */
.card, 
.navbar-light,
.dropdown-menu,
.modal-content,
.list-group-item,
.table,
.form-control,
.bg-white {
    background-color: var(--bs-white) !important;
}

/* Form Input Text Styling: Ensure proper contrast for readability */
.form-control {
    color: #212529 !important;  /* Dark text for better readability */
    font-weight: 400;
}

.form-control::placeholder {
    color: #3d3333 !important;  /* Dark color for better readability */
    opacity: 0.7;
}

/* Focus state for form inputs */
.form-control:focus {
    color: #212529 !important;  /* Maintain dark text on focus */
    background-color: var(--bs-white) !important;
    border-color: var(--bs-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(163, 224, 227, 0.25) !important;
}

/* Form select (dropdown) styling for better visibility */
.form-select {
    color: #3d3333 !important;
    background-color: var(--bs-white) !important;
    border-color: #ced4da;
}

.form-select:focus {
    color: #3d3333 !important;
    background-color: var(--bs-white) !important;
    border-color: var(--bs-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(163, 224, 227, 0.25) !important;
}

.form-select option {
    color: #3d3333 !important;
    background-color: var(--bs-white) !important;
}

/* Comprehensive text contrast fixes */
/* Override Bootstrap muted text classes */
.text-muted {
    color: #3d3333 !important;
}

/* Help text and descriptive text */
.form-text {
    color: #3d3333 !important;
}

/* Card text and content */
.card-text {
    color: #3d3333 !important;
}

/* File upload text */
.form-control[type="file"]::file-selector-button {
    color: #3d3333 !important;
    background-color: #f8f9fa !important;
    border-color: #ced4da !important;
}

/* Ensure all Bootstrap secondary text uses proper contrast */
.text-secondary {
    color: #3d3333 !important;
}

/* Portal button grid styling - Uniform sizing for all buttons */
.portal-btn-grid .btn {
    min-height: 80px;
    max-height: 80px;
    font-size: 0.8rem;
    line-height: 1.1;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.25rem;
    overflow: hidden;
}

.portal-btn-grid .btn i {
    flex-shrink: 0;
    margin-bottom: 0.25rem;
    margin-right: 0;
    font-size: 1.1rem;
}

.portal-btn-grid .btn span {
    display: block;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    hyphens: auto;
    word-break: break-word;
}

/* Mobile responsive adjustments */
@media (max-width: 576px) {
    .portal-btn-grid .btn {
        min-height: 75px;
        max-height: 75px;
        font-size: 0.75rem;
        padding: 0.4rem 0.2rem;
    }
    
    .portal-btn-grid .btn i {
        font-size: 1rem;
        margin-bottom: 0.2rem;
    }
}

/* Tablet adjustments */
@media (min-width: 577px) and (max-width: 768px) {
    .portal-btn-grid .btn {
        min-height: 78px;
        max-height: 78px;
        font-size: 0.77rem;
    }
}

/* Desktop adjustments */
@media (min-width: 769px) {
    .portal-btn-grid .btn {
        min-height: 85px;
        max-height: 85px;
        font-size: 0.82rem;
        padding: 0.6rem 0.3rem;
    }
    
    .portal-btn-grid .btn i {
        font-size: 1.1rem;
        margin-bottom: 0.3rem;
    }
}

/* Responsive Image Handling */
img {
    max-width: 100%;
    height: auto;
}

/* Mobile-First Responsive Design */
@media (max-width: 768px) {
    .hero-section {
        background-size: cover;
        background-position: center;
    }

    img {
        max-width: 768px;
    }
}

/* Desktop Styles */
@media (min-width: 769px) {
    img {
        max-width: 1920px;
    }
}

/* Layout Utilities */
main {
    flex: 1;  /* Pushes footer to bottom */
}

/* Navigation Styling */
.navbar-brand {
    font-weight: 600;  /* Makes logo/brand text more prominent */
    color: #3d3333 !important;  /* Custom text color for brand */
    padding-right: 20px;  /* Add space between logo and nav items */
}

/* Banyan Tree Logo Styling */
.banyan-tree-logo {
    height: 28px;
    width: auto;
    margin-right: 8px;
    vertical-align: middle;
    filter: brightness(0.2);  /* Darken the SVG to match text color */
}

.navbar-dark .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

.navbar-toggler {
    border-color: rgba(255, 255, 255, 0.3) !important;
}

/* Dropdown Menu Text Color */
.navbar-dark .navbar-nav .nav-link,
.dropdown-menu .dropdown-item {
    color: #3d3333 !important;
}

/* Simple Header design matching exact image layout */
.simple-header {
    background-color: var(--bs-primary) !important;
    padding: 0.75rem 0;
    border: none;
    box-shadow: none;
}

.simple-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo styling */
.navbar-brand-container {
    display: flex;
    align-items: center;
}

.navbar-brand {
    color: #3d3333 !important;
    font-weight: 600;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    margin-right: 0;
    padding: 0;
}

.banyan-tree-logo {
    height: 30px;
    width: auto;
    margin-right: 10px;
    filter: brightness(0) invert(1);
}

/* Simple horizontal navigation */
.simple-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: 2rem;
}

.simple-nav .nav-item {
    color: #3d3333 !important;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
    padding: 0;
    border: none;
    background: transparent;
    position: relative;
    white-space: nowrap;
}

.simple-nav .nav-item:hover,
.simple-nav .nav-item.active {
    color: #212529 !important;
    opacity: 0.8;
}

/* User menu in the top right */
.user-menu {
    margin-left: 1rem;
}

.dropdown-toggle {
    color: #3d3333 !important;
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.dropdown-toggle::after {
    margin-left: 0.5rem;
}

.dropdown-toggle i {
    margin-right: 0.25rem;
}

.auth-link {
    color: #3d3333 !important;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.auth-link:hover {
    color: #212529 !important;
    opacity: 0.8;
}

/* Mobile menu styling */
.navbar-toggler {
    border: none;
    color: #3d3333 !important;
    padding: 0.25rem 0.5rem;
    font-size: 1.1rem;
    background: transparent;
    outline: none !important;
    box-shadow: none !important;
}

/* Mobile navigation collapse menu */
.navbar-collapse {
    background-color: var(--bs-primary);
    border-top: 1px solid rgba(61, 51, 51, 0.1);
}

/* Override Bootstrap's default nav-link color for mobile - highest specificity */
.navbar-collapse .navbar-nav .nav-item .nav-link {
    color: #3d3333 !important;
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(61, 51, 51, 0.1);
}

.navbar-collapse .navbar-nav .nav-item .nav-link:hover,
.navbar-collapse .navbar-nav .nav-item .nav-link.active {
    color: #212529 !important;
    background-color: rgba(61, 51, 51, 0.1);
    opacity: 0.9;
}

/* Additional override for any remaining nav-link elements */
.navbar-collapse .nav-link {
    color: #3d3333 !important;
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(61, 51, 51, 0.1);
}

.navbar-collapse .nav-link:hover,
.navbar-collapse .nav-link.active {
    color: #212529 !important;
    background-color: rgba(61, 51, 51, 0.1);
    opacity: 0.9;
}

/* Mobile separator styling */
.navbar-collapse .text-light {
    border-color: rgba(61, 51, 51, 0.3) !important;
}

.mobile-nav {
    background-color: var(--bs-primary);
    border-top: 1px solid rgba(255,255,255,0.1);
}

.mobile-nav-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mobile-nav-item {
    color: #3d3333 !important;
    text-decoration: none;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(61, 51, 51, 0.1);
    font-weight: 500;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    color: #212529 !important;
    opacity: 0.8;
}

/* Dropdown styles */
.dropdown-menu {
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border: none;
    margin-top: 0.5rem;
    animation: dropdown-animation 0.2s ease forwards;
}

@keyframes dropdown-animation {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dropdown-item {
    padding: 0.5rem 1.25rem;
    transition: all 0.2s ease;
    color: #3d3333 !important;
}

.dropdown-item:hover {
    background-color: rgba(61, 51, 51, 0.05);
    color: #212529 !important;
}

/* Footer Styling */
footer {
    margin-top: auto;  /* Sticks footer to bottom */
    background-color: #3d3333 !important;
    font-size: 0.9rem;
    color: #ffffff !important;
}

/* More compact footer styling */
footer h6 {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff !important;
}

footer .small {
    font-size: 0.85rem;
    color: #ffffff !important;
}

/* Ensure all footer text is white */
footer, 
footer * {
    color: #ffffff !important;
}

footer a {
    color: #ffffff !important;
}

footer a:hover {
    color: #a3e0e3 !important;
}

footer .text-light {
    color: #ffffff !important;
}

footer .footer-links {
    line-height: 1.2;
}

footer .social-icons a {
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

footer .social-icons a:hover {
    opacity: 1;
}

/* Card Component Styling */
.card {
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: all 0.3s ease;  /* Smooth hover effect */
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Board Position Assignment Card Headers - Enhanced Legibility */
.card-header h6 {
    color: #212529 !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
    text-shadow: none !important;
    opacity: 1 !important;
}

/* Specific styling for board position cards */
.card-header .fas {
    color: #212529 !important;
    opacity: 0.8;
    margin-right: 0.5rem;
}

/* Ensure all card headers have proper contrast */
.card-header {
    background-color: #f8f9fa !important;
    border-bottom: 2px solid #dee2e6 !important;
    padding: 1rem !important;
}

/* Override any muted text in card headers */
.card-header .text-muted {
    color: #495057 !important;
    font-weight: 500 !important;
}

/* Google Maps Container Styling */
.map-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.map-container:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-3px);
}

.map-container:hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(166, 224, 224, 0.2);
    pointer-events: none;
}

.map-container iframe {
    width: 100%;
    height: 100%;
    min-height: 200px;
    border: none;
    display: block;
}

.map-container img {
    transition: all 0.3s ease;
    display: block;
    width: 100%;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);  /* Enhanced shadow on hover */
}

/* Card Layout Management */
.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-body .btn {
    margin-top: auto;  /* Pushes button to bottom of card */
}

.card-header {
    border-radius: 0.5rem 0.5rem 0 0 !important;  /* Rounded top corners */
}

/* Button Base Styling */
.btn {
    border-radius: 0.25rem;
}

/* Light Background Override */
.bg-light {
    background-color: var(--bs-white) !important;
}

/* Blog Content Typography and Spacing */
.blog-content img {
    max-width: 100%;
    height: auto;
}

.blog-content h1, 
.blog-content h2, 
.blog-content h3, 
.blog-content h4, 
.blog-content h5, 
.blog-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.blog-content p {
    margin-bottom: 1rem;
}

.blog-content ul, 
.blog-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

/* Calendar Widget Styling */
#calendar {
    max-width: 100%;
    margin: 0 auto;
}

.fc-event {
    cursor: pointer;
    border-radius: 0.25rem;
}

/* Compact UI Components */
.card-body {
    padding: 0.75rem;
}

.list-group-item {
    padding: 0.5rem 1rem;
}

.btn {
    padding: 0.375rem 0.75rem;
}

.card + .card {
    margin-top: 0.75rem;  /* Spacing between stacked cards */
}

/* Legend Card Specific Styling */
.legend-card .list-group-item {
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
}

/* Bulletin Board Category Labels */
.bulletin-category-badge {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

/* Text Truncation Utilities */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Admin Dashboard Statistics Cards */
.admin-stat-card {
    text-align: center;
    padding: 1.5rem;
}

.admin-stat-card .icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.admin-stat-card .value {
    font-size: 2rem;
    font-weight: bold;
}

.admin-stat-card .label {
    font-size: 1rem;
    color: #6c757d;
}

/* Responsive Design Enhancements - Mobile-First Approach */

/* Base mobile styles (0-575px) */
.container {
    padding-left: 15px;
    padding-right: 15px;
}

/* Fluid Typography */
h1, .h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

h2, .h2 {
    font-size: clamp(1.3rem, 3.5vw, 2rem);
}

h3, .h3 {
    font-size: clamp(1.1rem, 3vw, 1.75rem);
}

.display-5 {
    font-size: clamp(2rem, 6vw, 3rem);
}

.lead {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
}

/* Enhanced Mobile Navigation (up to tablet) */
@media (max-width: 991.98px) {
    /* Hide desktop navigation on tablets and mobile */
    .simple-nav {
        display: none !important;
    }

    /* Show mobile toggle button */
    .navbar-toggler {
        display: block !important;
        border: none;
        padding: 0.25rem 0.5rem;
        background: rgba(61, 51, 51, 0.1);
        border-radius: 0.375rem;
    }

    /* Mobile navigation dropdown */
    .navbar-collapse {
        background-color: var(--bs-primary);
        padding: 1rem;
        border-radius: 0 0 0.5rem 0.5rem;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        max-height: 80vh;
        overflow-y: auto;
        margin-top: 0.5rem;
    }

    .navbar-nav .nav-item {
        margin-bottom: 0.5rem;
    }

    .navbar-nav .nav-link {
        padding: 0.75rem 1rem !important;
        border-radius: 4px;
        color: #ffffff !important;
        font-weight: 500;
        min-height: 44px; /* Touch-friendly size */
        display: flex;
        align-items: center;
    }

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

/* Small Mobile Specific (up to 575px) */
@media (max-width: 575.98px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Hero section adjustments */
    .hero-section {
        padding: 2rem 1rem !important;
    }

    .hero-section .fs-4 {
        font-size: 1.1rem !important;
    }

    /* Card adjustments */
    .card-body {
        padding: 1rem;
    }

    /* Button adjustments */
    .btn {
        min-height: 44px; /* Touch-friendly */
        padding: 0.5rem 1rem;
    }

    .btn-lg {
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
    }
}

/* Tablet Specific (576px - 991px) */
@media (min-width: 576px) and (max-width: 991.98px) {
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }

    /* Optimize card layouts for tablets */
    .row-cols-md-2 > * {
        flex: 0 0 auto;
        width: 50%;
    }

    .row-cols-md-3 > * {
        flex: 0 0 auto;
        width: 33.333333%;
    }

    /* Hero section tablet optimization */
    .hero-section {
        padding: 3rem 2rem !important;
    }
}

/* Large tablets and small desktop (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .simple-nav {
        gap: 1rem; /* Reduce gap for smaller desktop */
    }

    .simple-nav .nav-item {
        font-size: 0.9rem;
    }
}

/* Enhanced Card Layouts for All Screen Sizes */
.card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Card Grid Improvements */
.row.g-3 {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}

/* Touch-friendly buttons across all devices */
.btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Card body optimization */
.card-body {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-body .btn {
    margin-top: auto; /* Push buttons to bottom */
}

/* Feature cards on homepage */
.card.h-100 .card-body {
    padding: 1.5rem;
}

/* Small mobile specific adjustments */
@media (max-width: 575.98px) {
    .card.h-100 .card-body {
        padding: 1rem;
    }

    .card.h-100 .card-body .fa-3x {
        font-size: 2rem !important; /* Smaller icons on mobile */
    }

    /* Optimize button spacing in cards */
    .card-body .btn + .btn {
        margin-top: 0.5rem;
    }
}

/* Tablet optimizations */
@media (min-width: 576px) and (max-width: 991.98px) {
    .card.h-100 .card-body {
        padding: 1.25rem;
    }

    /* Ensure equal height cards work properly */
    .row-cols-md-2 .card,
    .row-cols-md-3 .card {
        height: 100%;
    }
}

/* Mobile footer adjustments */
@media (max-width: 767.98px) {
    footer .row > div {
        margin-bottom: 1rem;
        text-align: center;
    }

    footer .footer-links {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        margin: 0.5rem 0;
    }

    footer .footer-links a {
        margin: 0.25rem;
    }

    footer .social-icons {
        display: flex;
        justify-content: center;
        margin-bottom: 0.5rem;
    }
}

.list-group-item.active, 
.list-group-item:active {
    background-color: var(--bs-primary) !important;
    color: #3d3333 !important;
}

/* Ensure white text stays white for dark backgrounds */
.bg-dark,
.btn-primary,
.card-header {
  color: #fff !important;
}

/* Navigation text should use dark color on teal background */
.navbar-brand, .nav-link {
  color: #3d3333 !important;
}

/* Force dark text specifically for mobile navbar */
.navbar-collapse .navbar-nav .nav-link {
  color: #3d3333 !important;
}

/* Override any Bootstrap navbar defaults on teal background */
.simple-header .nav-link {
  color: #3d3333 !important;
}