/* Theme Variables */
:root {
    /* Base Colors */
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --light-color: #f8f9fc;
    --dark-color: #5a5c69;
    
    /* Admin & Landlord Theme Colors */
    --admin-primary: #2c3e50;
    --admin-secondary: #34495e;
    --admin-accent: #3498db;
    --admin-success: #27ae60;
    --admin-warning: #f39c12;
    --admin-danger: #e74c3c;
    --admin-background: #ecf0f1;
    --admin-surface: #ffffff;
    --admin-text: #2d3436;
    --admin-text-secondary: #4a5568;
    --admin-border: #dfe6e9;
    --admin-hover: #4a5568;
    
    /* Staff Theme Colors - Distinct Professional */
    --staff-primary: #553c9a;
    --staff-secondary: #6b46c1;
    --staff-accent: #805ad5;
    --staff-background: #f7fafc;
    --staff-surface: #ffffff;
    --staff-text: #2d3748;
    --staff-text-secondary: #4a5568;
    --staff-muted: #718096;
    --staff-border: #e2e8f0;
    --staff-hover: #ebf4ff;
    --staff-active: #e9d8fd;
    
    /* Student/Tenant Theme Colors - Subtle Blue with Pink Accent */
    --student-primary: #4299e1;
    --student-secondary: #63b3ed;
    --student-accent: #fbd5d5;
    --student-background: #ebf8ff;
    --student-surface: #ffffff;
    --student-text: #2d3748;
    --student-text-secondary: #4a5568;
    --student-muted: #718096;
    --student-border: #bee3f8;
    --student-hover: #e6fffa;
    --student-active: #90cdf4;
}

/* Admin Theme (Same as Landlord) */
.admin-theme,
.landlord-theme {
    background-color: var(--admin-background) !important;
    color: var(--admin-text) !important;
}

.admin-theme .sidebar,
.landlord-theme .sidebar {
    background: linear-gradient(180deg, var(--admin-primary) 0%, var(--admin-secondary) 100%) !important;
    border-right: 1px solid var(--admin-border);
    box-shadow: 0 0.15rem 1.75rem 0 rgba(44, 62, 80, 0.15);
}

.admin-theme .nav-link,
.landlord-theme .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    padding: 1rem 1.5rem;
    border-radius: 0.35rem;
    margin: 0.2rem 1rem;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.admin-theme .nav-link:hover,
.landlord-theme .nav-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
    border-left: 3px solid var(--admin-accent);
}

.admin-theme .nav-link.active,
.landlord-theme .nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--admin-accent);
}

.admin-theme .card,
.landlord-theme .card {
    background-color: var(--admin-surface) !important;
    border: 1px solid var(--admin-border);
    box-shadow: 0 0.15rem 1.75rem 0 rgba(44, 62, 80, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.admin-theme .card:hover,
.landlord-theme .card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 2rem 0 rgba(44, 62, 80, 0.12);
}

.admin-theme .card-header,
.landlord-theme .card-header {
    background-color: var(--admin-surface) !important;
    border-bottom: 1px solid var(--admin-border);
    padding: 1.25rem 1.5rem;
}

.admin-theme .btn-primary,
.landlord-theme .btn-primary {
    background: var(--admin-primary) !important;
    border-color: var(--admin-primary) !important;
    color: white !important;
}

.admin-theme .btn-primary:hover,
.landlord-theme .btn-primary:hover {
    background: var(--admin-hover) !important;
    border-color: var(--admin-hover) !important;
    transform: translateY(-2px);
}

.admin-theme .table,
.landlord-theme .table {
    background-color: var(--admin-surface) !important;
    color: var(--admin-text);
}

.admin-theme .table thead th,
.landlord-theme .table thead th {
    background-color: var(--admin-background) !important;
    border-bottom: 2px solid var(--admin-border);
    color: var(--admin-text);
}

/* Staff Theme - New Professional Look */
.staff-theme {
    background-color: var(--staff-background) !important;
    color: var(--staff-text) !important;
}

.staff-theme .sidebar {
    background: linear-gradient(180deg, var(--staff-primary) 0%, var(--staff-secondary) 100%) !important;
    border-right: 1px solid var(--staff-border);
}

.staff-theme .nav-link {
    color: var(--staff-text-secondary) !important;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    margin: 0.2rem 0.75rem;
    transition: all 0.2s ease;
}

.staff-theme .nav-link:hover {
    color: var(--staff-primary) !important;
    background: var(--staff-hover);
}

.staff-theme .nav-link.active {
    background: var(--staff-active);
    color: var(--staff-primary) !important;
    border-left: 3px solid var(--staff-accent);
}

.staff-theme .card {
    background-color: var(--staff-surface) !important;
    border: 1px solid var(--staff-border);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Student/Tenant Theme - Subtle Blue with Pink Accents */
.student-theme {
    background-color: var(--student-background) !important;
    color: var(--student-text) !important;
}

.student-theme .sidebar {
    background: linear-gradient(180deg, var(--student-primary) 0%, var(--student-secondary) 100%) !important;
    border-right: 1px solid var(--student-border);
}

.student-theme .nav-link {
    color: var(--student-text) !important;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    margin: 0.2rem 0.75rem;
    transition: all 0.2s ease;
}

.student-theme .nav-link:hover {
    background: var(--student-hover);
    border-left: 3px solid var(--student-accent);
}

.student-theme .nav-link.active {
    background: var(--student-active);
    border-left: 3px solid var(--student-accent);
}

.student-theme .card {
    background-color: var(--student-surface) !important;
    border: 1px solid var(--student-border);
    box-shadow: 0 4px 6px rgba(66, 153, 225, 0.05);
}

.student-theme .card:hover {
    border-color: var(--student-accent);
}

/* Common Interactive Elements */
.btn-primary {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.student-theme .btn-primary {
    background: var(--student-primary) !important;
    border: none !important;
}

.student-theme .table {
    background-color: var(--student-surface) !important;
    color: var(--student-text);
}

/* Tables */
.table {
    border-radius: 8px;
    overflow: hidden;
}

.admin-theme .table,
.landlord-theme .table {
    background-color: var(--admin-surface) !important;
    color: var(--admin-text);
}

.staff-theme .table {
    background-color: var(--staff-surface) !important;
    color: var(--staff-text);
}

.student-theme .table {
    background-color: var(--student-surface) !important;
    color: var(--student-text);
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        z-index: 1030;
        width: 100%;
        max-width: 250px;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* Desktop Mode - Keep hamburger visible for toggle functionality */
@media (min-width: 769px) {
    /* Show hamburger menu on desktop - user wants to toggle sidebar */
    .navbar-toggler {
        display: block !important;
    }
    
    /* Desktop sidebar positioning - let Bootstrap handle collapse */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1030;
        width: 250px;
        max-width: 250px;
    }
    
    /* Ensure sidebar can scroll on desktop */
    #sidebarMenu {
        overflow-y: auto;
        transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
        /* Prevent Bootstrap from using display:none - use transform instead */
        display: block !important;
        /* Override any inline styles Bootstrap might add */
    }
    
    /* Override Bootstrap's inline display styles on desktop */
    #sidebarMenu[style*="display: none"],
    #sidebarMenu[style*="display:none"] {
        display: block !important;
    }
    
    /* When sidebar is collapsed on desktop, hide it with transform */
    #sidebarMenu.collapse:not(.show) {
        transform: translateX(-100%);
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }
    
    #sidebarMenu.collapse.show {
        transform: translateX(0);
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }
    
    /* When sidebar is collapsed on desktop, shift main content */
    body:not(.sidebar-open) .main-content {
        margin-left: 0;
        transition: margin-left 0.3s ease;
    }
    
    body.sidebar-open .main-content {
        margin-left: 250px;
        transition: margin-left 0.3s ease;
    }
    
    /* Make hamburger button visible and properly styled on desktop */
    .navbar-toggler {
        border: 1px solid rgba(0, 0, 0, 0.1);
        padding: 0.25rem 0.5rem;
        cursor: pointer;
    }
    
    .navbar-toggler:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }
}

/* Hamburger Menu Visibility Control */
.navbar-toggler {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Modal Backdrop Fix - Ensure modals appear above sidebar */
.modal-backdrop {
    z-index: 1060 !important;
}

.modal {
    z-index: 1070 !important;
}

/* Mobile-First Image Handling */
.lazy {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.lazy.loaded {
    opacity: 1;
}

/* Enhanced Carousel for Touch Devices */
.carousel {
    touch-action: pan-y pinch-zoom;
    position: relative;
    overflow: hidden;
}

.carousel-item img {
    transition: transform 0.3s ease-out;
    transform-origin: center;
    touch-action: pan-y pinch-zoom;
}

.carousel-item.zoomed {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

/* Image Gallery Grid */
.image-gallery {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

@media (min-width: 576px) {
    .image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

.image-gallery img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    /* Adjust card layouts */
    .card {
        margin-bottom: 1rem;
    }

    /* Make buttons more touch-friendly */
    .btn {
        padding: 0.75rem 1rem;
        min-height: 44px;
    }

    /* Improve table responsiveness */
    .table-responsive {
        margin-bottom: 1rem;
        -webkit-overflow-scrolling: touch;
    }

    /* Enhance form elements for touch */
    input, select, textarea {
        font-size: 16px !important; /* Prevent iOS zoom */
        padding: 0.75rem !important;
    }

    /* Adjust spacing for mobile */
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    [class*="col-"] {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    /* Improve navigation for touch */
    .nav-link {
        padding: 1rem !important;
    }

    /* Enhanced touch targets */
    .dropdown-item {
        padding: 0.75rem 1rem;
    }

    /* Improved scrolling */
    .sidebar {
        -webkit-overflow-scrolling: touch;
    }
}

/* Loading Placeholders */
.image-placeholder {
    background: linear-gradient(90deg, #f0f0f0 0%, #f8f8f8 50%, #f0f0f0 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Responsive Typography */
@media (max-width: 576px) {
    h1, .h1 { font-size: 1.75rem; }
    h2, .h2 { font-size: 1.5rem; }
    h3, .h3 { font-size: 1.25rem; }
    h4, .h4 { font-size: 1.125rem; }
    h5, .h5 { font-size: 1rem; }
}

/* Touch-friendly Scrollbars */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

/* Hamburger Menu Styles */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: rgba(78, 115, 223, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    transition: all 0.3s ease;
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hamburger-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}

.hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.side-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 350px;
    height: 100vh;
    background: white;
    z-index: 1040;
    transition: right 0.3s ease;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

.side-menu.active {
    right: 0;
}

.side-menu-content {
    padding: 2rem 1.5rem;
    height: 100%;
}

.side-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #f8f9fa;
    color: #495057;
}

.side-menu-buttons {
    margin-bottom: 2rem;
}

.btn-user {
    padding: 0.75rem 1rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-user:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.support-section {
    border-top: 1px solid #e9ecef;
    padding-top: 1rem;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main content positioning - only for landing page */
.bg-gradient-primary .main-content {
    margin-top: 80px; /* Account for fixed top nav */
    min-height: calc(100vh - 80px);
}

/* Ensure body doesn't scroll when menu is open */
body.menu-open {
    overflow: hidden;
}


/* Add to existing responsive section */
@media (max-width: 768px) {
    .main-content {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .card-body {
        padding: 1rem;
    }

    .table td, 
    .table th {
        padding: 0.75rem;
    }

    /* Improve mobile navigation */
    .navbar-toggler {
        padding: 0.75rem;
        margin-right: 0.5rem;
    }

    /* Enhanced mobile modals */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: 1rem;
    }

    .modal-header,
    .modal-footer {
        padding: 1rem;
    }

    /* Improved mobile search */
    .search-form {
        position: sticky;
        top: 0;
        z-index: 1020;
        background: var(--light-color);
        padding: 1rem;
        margin: -1rem -1rem 1rem -1rem;
        border-bottom: 1px solid rgba(0,0,0,0.1);
    }
}