main#dashboardMain {
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    margin-left: 250px; /* Add margin to account for the fixed sidebar */
    width: calc(100% - 250px); /* Adjust width to fit remaining space */
    /* Ensure it doesn't go behind the fixed header */
    position: relative;
    z-index: 1;
}

main#dashboardMain section {
    padding: 20px 0;
    display: block;
    width: 100%;
    /* flex: 1; */ /* Removed to prevent sections from growing */
    margin-bottom: 0;
    border-bottom: none;
}

#calendarSection {
    padding-right: 20px;
}

#weekAppointmentsSection {
    padding-left: 20px;
}

header {
    background: #333;
    color: #fff;
    padding: 1rem 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 250px;
    z-index: 100;
    overflow-y: auto;
}

header h1 {
    text-align: center;
    margin-bottom: 1rem;
    width: 100%;
}

nav {
    text-align: center;
    width: 100%;
}

nav button {
    margin: 0 10px;
    padding: 10px 20px;
    background-color: #444;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

nav button:hover {
    background-color: #555;
}

header nav ul {
    list-style-type: none;
    padding: 0;
    margin: 0 auto;
    width: 90%;
    text-align: center;
}

header nav ul li {
    display: block;
    margin: 5px 0;
    text-align: center;
}

header nav ul li button {
    display: block;
    width: 100%;
    margin: 0 auto;
    padding: 10px 15px;
    background-color: #444;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    text-align: center;
    min-width: unset;
}


/* Style for the Add Tenant button next to the Manage Tenants title */
#manageTenantsSection h2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#addTenantBtnInTitle {
    padding: 5px 10px;
    font-size: 0.9em;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

#addTenantBtnInTitle:hover {
    background-color: #0056b3;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    border-radius: 4px;
    width: 80%;
    max-width: 1000px;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-top: 0;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Form styling inside the modal */
#addTenantForm label {
    display: block;
    margin-top: 10px;
}

#addTenantForm input {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    box-sizing: border-box;
}

#addTenantForm button {
    margin-top: 15px;
    padding: 10px 15px;
    margin-right: 10px;
}

/* Table styling for the Manage Tenants section */
#manageTenantsSection table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

#manageTenantsSection th {
    background-color: #4CAF50;
    color: white;
    text-align: left;
    padding: 12px 15px;
}

#manageTenantsSection td {
    padding: 10px 15px;
    border: none;
}

/* Horizontal scroll wrapper: the Manage Tenants grid has many columns */
.tenants-table-wrap {
    width: 100%;
    overflow-x: auto;
}

/* Zebra striping for table rows */
#manageTenantsSection tbody tr:nth-child(even) {
    background-color: #f2f2f2;
}

#manageTenantsSection tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

/* Style for action buttons within the table */
#manageTenantsSection tbody td button {
    margin-right: 5px;
    margin-bottom: 5px;
    padding: 5px 10px;
    font-size: 0.8em;
}

/* Table styling for the services table inside the modal */
.services-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background-color: #e6f3ff;
}

.services-table th {
    background-color: #1e90ff;
    color: white;
    text-align: left;
    padding: 12px 15px;
}

.services-table td {
    padding: 10px 15px;
    border: none;
}

/* Zebra striping for table rows */
.services-table tbody tr:nth-child(even) {
    background-color: #cce6ff;
}

.services-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

/* Style for action buttons within the services table */
.services-table tbody td button {
    margin-right: 5px;
    margin-bottom: 5px;
    padding: 5px 10px;
    font-size: 0.8em;
}

/* Table styling for the resources table */
.resources-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.resources-table th {
    background-color: #FF6B6B;
    color: white;
    text-align: left;
    padding: 12px 15px;
}

.resources-table td {
    padding: 10px 15px;
    border: none;
}

/* Zebra striping for table rows */
.resources-table tbody tr:nth-child(even) {
    background-color: #ffe0e0;
}

.resources-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

/* Style for action buttons within the resources table */
.resources-table tbody td button {
    margin-right: 5px;
    margin-bottom: 5px;
    padding: 5px 10px;
    font-size: 0.8em;
}

/* Tenant admin: services/resources edit forms (view/edit only) */
#tenantServiceEditForm,
#tenantResourceEditForm {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

#tenantServiceEditForm h3,
#tenantResourceEditForm h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

#tenantServiceEditForm label,
#tenantResourceEditForm label {
    display: block;
    margin-top: 10px;
    font-weight: 600;
}

#tenantServiceEditForm input[type="text"],
#tenantServiceEditForm input[type="number"],
#tenantServiceEditForm textarea,
#tenantResourceEditForm input[type="text"],
#tenantResourceEditForm input[type="number"],
#tenantResourceEditForm textarea {
    width: 100%;
    max-width: 480px;
    padding: 8px;
    margin-top: 4px;
    box-sizing: border-box;
}

#tenantResourceEditForm input[type="checkbox"] {
    width: auto;
    margin-top: 8px;
}

#tenantServiceEditForm button,
#tenantResourceEditForm button {
    margin-top: 15px;
    margin-right: 8px;
}

/* Tenant services/resources sections: horizontal scroll on small screens */
@media (max-width: 768px) {
    #tenantServicesSection,
    #tenantResourcesSection {
        overflow-x: auto;
    }

    #tenantServicesTable,
    #tenantResourcesTable {
        min-width: 520px;
    }
}

/* Style for the Add Service button inside the modal's service page */
.modal-services-page h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Widget Code Modal Styles */
#widgetCodeDisplay {
    background-color: #f4f4f4;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 10px 0;
    max-height: 150px;
    overflow-y: auto;
}

#copyWidgetCodeBtn {
    padding: 10px 15px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#copyWidgetCodeBtn:hover {
    background-color: #218838;
}

/* Invite Link Modal Styles */
#inviteLinkDisplay {
    background-color: #f4f4f4;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 10px 0;
}

#copyInviteLinkBtn {
    padding: 10px 15px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#copyInviteLinkBtn:hover {
    background-color: #218838;
}

/* Booking Widget Modal Styles */
.booking-step {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
}

#timeSlotsContainer {
    margin-top: 10px;
}

.time-slot-btn {
    display: inline-block;
    padding: 8px 12px;
    margin: 5px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.time-slot-btn:hover {
    background-color: #0056b3;
}

#confirmAppointmentBtn, #confirmNewAppointmentBtn {
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}

#confirmAppointmentBtn:hover, #confirmNewAppointmentBtn:hover {
    background-color: #218838;
}

/* Calendar Styles */
#calendarSection {
    margin-bottom: 30px;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-bottom: 1px solid #eee;
}

#weekAppointmentsSection {
    margin-bottom: 30px;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-top: 1px solid #eee;
}

#calendarHeader {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: bold;
    margin-bottom: 5px;
    background-color: #e0e0e0;
    padding: 10px 0;
}

#calendarGrid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day {
    height: 80px;
    border: 1px solid #ccc;
    padding: 5px;
    cursor: pointer;
    background-color: white;
    display: flex;
    flex-direction: column;
}

.calendar-day:hover {
    background-color: #f0f0f0;
}

.calendar-day.occupied {
    background-color: #d4edda;
    border: 1px solid #28a745;
}

.calendar-day.occupied .appointment-count {
    font-size: 0.8em;
    color: #28a745;
    font-weight: bold;
    margin-top: auto;
}

.calendar-day .day-number {
    font-weight: bold;
    font-size: 1.1em;
}

.calendar-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#prevMonthBtn, #nextMonthBtn {
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#prevMonthBtn:hover, #nextMonthBtn:hover {
    background-color: #0056b3;
}

/* Unified Table Styling for both appointments tables */
.appointments-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background-color: #f9f9f9;
}

.appointments-table th {
    background-color: #4CAF50;
    color: white;
    text-align: left;
    padding: 12px 15px;
    font-weight: bold;
}

.appointments-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
    vertical-align: middle;
}

/* Zebra striping for table rows */
.appointments-table tbody tr:nth-child(even) {
    background-color: #f2f2f2;
}

.appointments-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

/* Style for action buttons within the tables */
.appointments-table tbody td button {
    margin-right: 5px;
    margin-bottom: 5px;
    padding: 5px 10px;
    font-size: 0.8em;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.appointments-table tbody td button:hover {
    opacity: 0.8;
}

/* Add spacing between sections */
main#dashboardMain section {
    padding: 20px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
}

/* Users Table Styles */
.users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.users-table th {
    background-color: #ffc107;
    color: #212529;
    text-align: left;
    padding: 12px 15px;
}

.users-table td {
    padding: 10px 15px;
    border: none;
}

/* Zebra striping for table rows */
.users-table tbody tr:nth-child(even) {
    background-color: #fff3cd;
}

.users-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

/* Style for action buttons within the users table */
.users-table tbody td button {
    margin-right: 5px;
    margin-bottom: 5px;
    padding: 5px 10px;
    font-size: 0.8em;
}

/* Settings Section Styles */
#businessRulesForm {
    max-width: 600px;
    margin: 20px 0;
}

#businessRulesForm label {
    display: block;
    margin-top: 15px;
    font-weight: bold;
}

#businessRulesForm input {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    box-sizing: border-box;
}

#saveBusinessRulesBtn {
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}

#saveBusinessRulesBtn:hover {
    background-color: #218838;
}

/* Admins Table Styles */
.admins-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.admins-table th {
    background-color: #6f42c1;
    color: white;
    text-align: left;
    padding: 12px 15px;
}

.admins-table td {
    padding: 10px 15px;
    border: none;
}

/* Zebra striping for table rows */
.admins-table tbody tr:nth-child(even) {
    background-color: #f1ecf7;
}

.admins-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

/* Style for action buttons within the admins table */
.admins-table tbody td button {
    margin-right: 5px;
    margin-bottom: 5px;
    padding: 5px 10px;
    font-size: 0.8em;
}

/* Tenant Admin Dashboard Layout */
#calendarSection, #appointmentsListSection, #weekAppointmentsSection, #settingsSection, #manageUsersSection, #tenantServicesSection, #tenantResourcesSection {
    display: block;
    margin-bottom: 30px;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#appointmentsListSection {
    display: none;
}

#settingsSection, #manageUsersSection, #tenantServicesSection, #tenantResourcesSection {
    display: none;
}

/* Calendar Section Specific Styles */
#calendarSection h2 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

#currentMonthYear {
    font-weight: bold;
    color: #333;
}

/* Appointments List Section Specific Styles */
#appointmentsListSection h2 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* Weekly Appointments Section Specific Styles */
#weekAppointmentsSection h2 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* Back to Calendar Button */
#backToCalendarBtn {
    margin-top: 15px;
    padding: 10px 20px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#backToCalendarBtn:hover {
    background-color: #5a6268;
}

/* ============================================================
   Responsive layout: hamburger menu + mobile portrait
   - Desktop: sidebar unchanged, hamburger hidden
   - Mobile: sidebar becomes a sticky top bar; nav collapses
     behind the hamburger; calendar grid goes compact
   ============================================================ */

/* Base styles for the hamburger + header-top row (desktop: hidden) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.6em;
    padding: 8px 15px;
    cursor: pointer;
    line-height: 1;
}

.header-top {
    display: block;
    width: 100%;
}

/* ============================================================
   Language toggle (tenant dashboard header, ES/EN)
   Shows the OTHER language code (like the /user PWA toggle)
   ============================================================ */
.lang-toggle {
    display: block;
    margin: 8px auto 0;
    padding: 4px 14px;
    font-size: 0.85em;
    font-weight: 600;
    color: #fff;
    background: transparent;
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.lang-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ============================================================
   PWA install banner (admin login page)
   ============================================================ */
.pwa-install-banner {
    margin-top: 15px;
    padding: 15px;
    border: 1px solid #4f46e5;
    border-radius: 8px;
    background-color: #eef2ff;
    color: #1f2937;
    text-align: center;
}

.pwa-install-banner h3 {
    margin: 0 0 5px;
    font-size: 1em;
}

.pwa-install-banner p {
    margin: 5px 0;
    font-size: 0.9em;
}

#adminInstallBtn {
    margin-top: 5px;
    padding: 10px 20px;
    background-color: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#adminInstallBtn:hover {
    background-color: #4338ca;
}

#adminDismissBtn {
    display: block;
    margin: 8px auto 0;
    background: none;
    border: none;
    color: #6b7280;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.8em;
    padding: 0;
}

#adminMenuHint {
    margin: 5px 0;
    font-size: 0.9em;
    color: #1f2937;
}

@media (max-width: 768px) {
    .lang-toggle {
        display: inline-block;
        margin: 0 8px 0 0;
        padding: 3px 10px;
    }
}

/* Logo images (login page + dashboard headers) */
.logo-img {
    display: block;
    margin: 0 auto 15px;
    max-width: 160px;
    max-height: 120px;
    object-fit: contain;
}

.header-logo {
    display: block;
    margin: 0 auto 10px;
    height: 48px;
    max-width: 140px;
    object-fit: contain;
    border-radius: 4px;
}

@media (max-width: 768px) {
    .header-logo {
        margin: 0 8px 0 5px;
        height: 30px;
        max-width: 90px;
    }
}

@media (max-width: 768px) {

    /* --- Header: fixed sidebar -> sticky top bar --- */
    header {
        position: sticky;
        top: 0;
        width: 100%;
        height: auto;
        padding: 0;
        overflow-y: visible;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }

    .menu-toggle {
        display: block;
    }

    .header-top {
        display: flex;
        align-items: center;
    }

    .header-top h1 {
        flex: 1;
        text-align: left;
        padding-left: 5px;
        margin: 0;
        font-size: 1.05em;
    }

    /* Nav collapses by default; opens when .nav-open is toggled */
    header nav {
        display: none;
        width: 100%;
    }

    header nav.nav-open {
        display: block;
    }

    header nav ul {
        width: 100%;
        padding: 5px 10px 10px;
    }

    /* --- Main content: full width, no sidebar margin --- */
    main#dashboardMain,
    main#superDashboardMain {
        margin-left: 0;
        width: 100%;
        padding: 12px 10px;
    }

    /* --- Sections: tighter padding on small screens --- */
    #calendarSection,
    #appointmentsListSection,
    #weekAppointmentsSection,
    #settingsSection,
    #manageUsersSection {
        padding: 12px;
    }

    /* --- Calendar: compact portrait month grid --- */
    #calendarSection h2 {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
        font-size: 1em;
    }

    #prevMonthBtn,
    #nextMonthBtn {
        padding: 5px 10px;
        font-size: 0.8em;
    }

    #calendarHeader {
        padding: 6px 0;
        font-size: 0.7em;
    }

    #calendarGrid {
        gap: 2px;
    }

    .calendar-day {
        height: 48px;
        padding: 3px;
    }

    .calendar-day .day-number {
        font-size: 0.75em;
    }

    .calendar-day .appointment-count {
        font-size: 0.6em;
    }

    /* --- Tables: horizontal scroll inside the section card --- */
    #appointmentsListSection,
    #weekAppointmentsSection,
    #manageUsersSection {
        overflow-x: auto;
    }

    .appointments-table,
    .users-table {
        min-width: 520px;
    }

    /* --- Modals: near full-screen on phones --- */
    .modal-content {
        width: 95%;
        max-width: 95%;
        max-height: 85vh;
        padding: 15px;
        margin: 5vh auto;
    }

    /* --- Forms: prevent iOS zoom-on-focus --- */
    input,
    select,
    textarea {
        font-size: 16px;
    }

    /* --- Settings form --- */
    #businessRulesForm {
        max-width: 100%;
    }
}