/* Mobile Responsive Enhancements for NorievMerlin Website & Dashboard */

/* Base responsive utilities */
* {
    box-sizing: border-box;
}

/* Admin Layout Fixes */
.main-content {
    margin-left: 200px;
    margin-top: 56px;
    padding: 20px;
    min-height: calc(100vh - 56px);
    background: #f8f9fa;
}

.side-nav {
    width: 200px;
    position: fixed;
    top: 56px;
    left: 0;
    height: calc(100vh - 56px);
    background: #343a40;
    color: #fff;
    padding-top: 20px;
    z-index: 1000;
    overflow-y: auto;
}

.side-nav a {
    color: #fff;
    display: block;
    padding: 10px 20px;
    text-decoration: none;
}

.side-nav a:hover {
    background: #495057;
}

/* Dark theme for admin */
body.admin-layout, .admin-layout * {
    background-color: #181c1f !important;
    color: #fff !important;
}

.admin-layout .main-content {
    background: #181c1f !important;
}

.admin-layout .card {
    background-color: #23272b !important;
    border-color: #343a40 !important;
}

.admin-layout .form-control, .admin-layout .form-select {
    background-color: #23272b !important;
    border-color: #444 !important;
    color: #fff !important;
}

.admin-layout .table {
    color: #fff !important;
    background-color: transparent !important;
}

.admin-layout .table-striped > tbody > tr:nth-of-type(odd) > td,
.admin-layout .table-striped > tbody > tr:nth-of-type(odd) > th {
    background-color: #23272b !important;
}

/* Mobile-first responsive design */
@media (max-width: 768px) {
    /* Main website mobile responsive fixes */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .hero .heading {
        font-size: 2rem !important;
        line-height: 1.2;
    }
    
    .hero {
        min-height: 300px;
        padding: 40px 0;
    }
    
    .hero .breadcrumb {
        font-size: 0.9rem;
    }
    
    /* Property cards responsive */
    .box-feature {
        margin-bottom: 1.5rem;
        padding: 1rem;
    }
    
    .box-feature img {
        max-height: 150px !important;
    }
    
    .box-feature h3 {
        font-size: 1.2rem;
    }
    
    /* Search form mobile */
    .card .row.g-3 > div {
        margin-bottom: 0.5rem;
    }
    
    .card .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Navigation mobile */
    .site-navbar .navbar-nav {
        flex-direction: column;
        width: 100%;
    }
    
    .site-navbar .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    /* Table responsive */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table td, .table th {
        white-space: nowrap;
        font-size: 0.85rem;
        padding: 0.5rem;
    }
    
    /* Footer mobile */
    .site-footer .row > div {
        margin-bottom: 2rem;
        text-align: center;
    }
}

/* Admin Dashboard Mobile Responsive */
@media (max-width: 991px) {
    /* Mobile layout adjustments */
    .main-content {
        margin-left: 0 !important;
        margin-top: 56px !important;
        padding: 15px !important;
    }
    
    /* Sidebar mobile */
    .side-nav {
        position: fixed;
        top: 56px;
        left: -280px;
        width: 280px;
        height: calc(100vh - 56px);
        background: #1a1d20;
        transition: left 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
        border-right: 1px solid #2c3034;
    }
    
    .side-nav.show {
        left: 0;
    }
    
    .side-nav-link {
        display: block;
        padding: 1rem 1.5rem;
        color: #adb5bd;
        text-decoration: none;
        border-bottom: 1px solid #2c3034;
        transition: all 0.3s ease;
    }
    
    .side-nav-link:hover {
        background: #2c3034;
        color: #fff;
        padding-left: 2rem;
    }
    
    /* Dropdown menus in sidebar */
    .message-dropdown, .web-settings-dropdown, .pages-dropdown,
    .estate-dropdown, .property-dropdown, .staff-dropdown {
        border-bottom: 1px solid #2c3034;
    }
    
    .message-dropdown > a, .web-settings-dropdown > a, .pages-dropdown > a,
    .estate-dropdown > a, .property-dropdown > a, .staff-dropdown > a {
        display: block;
        padding: 1rem 1.5rem;
        color: #adb5bd;
        text-decoration: none;
        background: #212529;
    }
    
    .message-dropdown > a:hover, .web-settings-dropdown > a:hover, 
    .pages-dropdown > a:hover, .estate-dropdown > a:hover,
    .property-dropdown > a:hover, .staff-dropdown > a:hover {
        background: #2c3034;
        color: #fff;
    }
    
    .message-dropdown div, .web-settings-dropdown div, .pages-dropdown div,
    .estate-dropdown div, .property-dropdown div, .staff-dropdown div {
        background: #1a1d20 !important;
        border-top: 1px solid #2c3034;
    }
    
    .message-dropdown div a, .web-settings-dropdown div a, .pages-dropdown div a,
    .estate-dropdown div a, .property-dropdown div a, .staff-dropdown div a {
        padding: 0.75rem 2.5rem !important;
        color: #adb5bd;
        font-size: 0.9rem;
        border-bottom: 1px solid #2c3034;
    }
    
    .message-dropdown div a:hover, .web-settings-dropdown div a:hover,
    .pages-dropdown div a:hover, .estate-dropdown div a:hover,
    .property-dropdown div a:hover, .staff-dropdown div a:hover {
        background: #2c3034;
        color: #fff;
    }
    
    /* Main content area */
    .main-content {
        margin-left: 0;
        padding: 1rem;
        width: 100%;
    }
    
    /* Topnav mobile */
    .sb-topnav {
        padding: 0.5rem 1rem;
    }
    
    .sb-topnav .navbar-brand {
        font-size: 1rem;
    }
    
    /* Mobile overlay for sidebar */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        display: none;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 576px) {
    /* Extra small devices */
    .main-content {
        padding: 0.5rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
    
    .form-control, .form-select {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    h1, h2, h3, h4, h5, h6 {
        font-size: calc(1rem + 0.5vw);
    }
    
    /* Navigation form mobile stacking */
    #navForm {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    #navForm > * {
        width: 100% !important;
        min-width: auto !important;
    }
    
    /* Table mobile scrolling */
    .nav-table {
        font-size: 0.75rem;
    }
    
    .nav-table td, .nav-table th {
        padding: 0.25rem;
        vertical-align: middle;
    }
    
    /* Edit form mobile */
    .edit-form {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    .edit-form > * {
        width: 100% !important;
        min-width: auto !important;
    }
    
    /* Hero section mobile */
    .hero .heading {
        font-size: 1.5rem !important;
    }
    
    /* Property cards extra small */
    .box-feature {
        text-align: center;
        padding: 0.75rem;
    }
    
    .box-feature img {
        max-height: 120px !important;
        width: 100%;
    }
}

/* Mobile navigation JavaScript trigger button */
@media (max-width: 991px) {
    #sidebarToggle {
        display: block !important;
    }
}

/* Responsive utilities */
.d-mobile-block {
    display: none !important;
}

.d-mobile-none {
    display: block !important;
}

@media (max-width: 768px) {
    .d-mobile-block {
        display: block !important;
    }
    
    .d-mobile-none {
        display: none !important;
    }
}

/* Print media */
@media print {
    .side-nav, .sb-topnav, .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
}
