body {
    font-family: 'Vazirmatn', 'Roboto', sans-serif;
    /* Added Roboto as fallback */
    background-color: #f5f5f5;
    color: #333;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.6;
    /* Improved readability */
}

header {
    background-color: #552575;
    color: white;
    padding: 1.5em 0;
    /* Increased padding */
    text-align: center;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* Added subtle shadow */
}

header h1 {
    margin: 0;
    font-size: 2.2em;
    /* Slightly larger */
    font-weight: 500;
    /* Adjusted font weight */
    margin-bottom: 0.3em;
    /* Space below title if nav is present */
}

.top-nav {
    margin-top: 0.5em;
    padding-bottom: 0.5em;
}

.top-nav a {
    color: #f0f0f0;
    text-decoration: none;
    margin: 0 1em;
    padding: 0.3em 0.6em;
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
}

.top-nav a:hover,
.top-nav a.active {
    /* 'active' class can be added via JS/PHP if needed */
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}


main {
    width: 90%;
    max-width: 1000px;
    /* Reduced max-width for a more compact form */
    margin: 2em auto;
    padding: 1.5em;
    /* Reduced padding for desktop */
    background-color: white;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-sizing: border-box;
}

h2 {
    color: #552575;
    text-align: center;
    margin-bottom: 1em;
}

.form-group {
    margin-bottom: 1em;
    /* Reduced spacing */
}

.form-group label {
    display: block;
    margin-bottom: 0.4em;
    /* Reduced spacing */
    font-weight: bold;
    color: #444;
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.7em;
    /* Reduced padding */
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1em;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input[type="text"]:focus,
.form-group input[type="tel"]:focus,
.form-group input[type="password"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #552575;
    box-shadow: 0 0 0 0.2rem rgba(85, 37, 117, 0.25);
    /* Focus ring */
    outline: none;
}


.form-group textarea {
    resize: vertical;
    min-height: 80px;
    /* Reduced min-height */
}

.form-group select[multiple] {
    min-height: 150px;
    /* Ensure multiple select is visible */
}

.form-group button:not(.btn-secondary-small):not(.btn-link-small) {
    background-color: #552575;
    color: white;
    padding: 0.7em 1.5em;
    /* Reduced padding */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    /* Slightly smaller font */
    font-family: 'Vazirmatn', sans-serif;
    transition: background-color 0.3s, transform 0.2s;
    display: block;
    margin: 1em auto 0;
    min-width: 150px;
    /* Reduced minimum width */
}

.form-group button:hover {
    background-color: #441e5e;
    transform: translateY(-2px);
    /* Slight lift on hover */
}

.form-group button:active {
    transform: translateY(0);
    /* Reset transform on click */
}


.form-group small {
    display: block;
    margin-top: 0.5em;
    font-size: 0.9em;
    color: #777;
}

#map {
    height: 350px;
    width: 100%;
    background-color: #e9e9e9;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-bottom: 1em;
    /* display: flex; align-items: center; justify-content: center; text-align: center; are removed */
    /* Leaflet will manage the content of this div. Placeholder text is handled by script.js */
    color: #666;
    /* Fallback color for placeholder if JS fails early */
    font-size: 1.1em;
    /* Fallback font size for placeholder */
    position: relative;
    /* Good for Leaflet controls */
}

/* If placeholder text needs styling before map loads */
#map:empty::before {
    content: 'در حال بارگذاری نقشه...';
    /* Default text if JS hasn't run yet to set specific placeholder */
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #777;
}


footer {
    text-align: center;
    padding: 1.5em 0;
    /* Increased padding */
    background-color: #333;
    color: white;
    width: 100%;
    margin-top: 2em;
    /* Added margin to separate from content */
}

footer p {
    margin: 0;
    font-size: 0.95em;
}

/* Material Design inspired input field focus animation */
.form-group input[type="text"],
.form-group input[type="tel"],
.form-group textarea {
    position: relative;
}

/* Utility class for error messages */
.error-message {
    /* This is for inline field errors, if used */
    color: #d9534f;
    /* Bootstrap danger color */
    font-size: 0.9em;
    margin-top: 0.3em;
    display: block;
    /* Ensure it takes its own line */
}

/* Message Banners for top of the form */
.message-banner {
    padding: 1em;
    margin-bottom: 1.5em;
    border-radius: 5px;
    border: 1px solid transparent;
    text-align: center;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.error-message-banner {
    /* General error banner */
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.error-summary ul {
    list-style-type: none;
    padding-right: 0;
    /* Adjusted for RTL */
    margin-bottom: 0;
}

.error-summary ul li {
    margin-bottom: 0.3em;
}

/* General Page Structure Enhancements */
.site-header {
    /* Used in customer_panel.php */
    background-color: #552575;
    color: white;
    padding: 1em 0;
    /* Adjusted padding */
    text-align: center;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.site-header .header-container {
    width: 90%;
    max-width: 1140px;
    /* Consistent max-width */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    /* Stack on small screens */
    align-items: center;
    justify-content: space-between;
}

.site-header h1 a {
    color: white;
    text-decoration: none;
    font-size: 2em;
    /* Adjusted from 2.2em for balance with nav */
    font-weight: 500;
}

.site-header .top-nav {
    /* Re-styling top-nav for consistency */
    margin-top: 0.5em;
}

.site-header .top-nav a {
    color: #f0f0f0;
    text-decoration: none;
    margin: 0 0.75em;
    /* Slightly reduced margin */
    padding: 0.4em 0.8em;
    /* Consistent padding */
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
}

.site-header .top-nav a:hover,
.site-header .top-nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
    /* Slightly more prominent active/hover */
    color: #fff;
}

.page-container {
    /* Wrapper for main content area */
    width: 100%;
    flex-grow: 1;
    /* Allows footer to stick to bottom if content is short */
    padding: 0;
    /* Padding for top/bottom of page content */
}

.panel-container {
    /* Base for panel content areas */
    width: 90%;
    margin: 2em auto;
    padding: 1.5em;
    /* Adjusted padding for desktop */
    box-sizing: border-box;
    /* Added to prevent padding from causing overflow */
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5em;
    padding-bottom: 1em;
    border-bottom: 1px solid #e0e0e0;
    /* Lighter border */
}

.panel-header h2 {
    margin: 0;
    /* Remove default margin from h2 */
    color: #552575;
    font-size: 1.6em;
    /* Adjusted size */
}

.panel-header div .btn {
    /* Styling for buttons in panel header */
    margin-left: 0.5em;
    /* RTL: margin-right */
}


/* Button Styles (General Purpose) */
.btn {
    display: inline-block;
    font-weight: 400;
    color: #212529;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    background-color: transparent;
    border: 1px solid transparent;
    padding: .5rem 1rem;
    /* Adjusted padding */
    font-size: 1rem;
    line-height: 1.5;
    border-radius: .3rem;
    /* Slightly more rounded */
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    text-decoration: none;
}

/* Custom styles for smaller buttons */
.btn-secondary-small {
    font-family: 'Vazirmatn', sans-serif;
    color: #552575;
    border: none;
    border-radius: 1rem;
    padding: .3rem .6rem;
    font-size: 0.9rem;
}

.btn-secondary-small:hover {
    color: #FFF;
}

.btn-secondary-small:disabled {
    cursor: no-drop;
}


.btn-link-small {
    color: #441e5e;
    /* Link color */
    background-color: transparent;
    border-color: transparent;
    padding: .3rem .6rem;
    /* Smaller padding */
    font-size: 0.9rem;
    /* Smaller font size */
    text-decoration: none;
    /* No underline */
}

.btn-link-small:hover {
    color: #000000;
    /* Darker color on hover */
}

.btn-link-small:disabled {
    cursor: no-drop;
}


.btn-primary {
    font-family: 'Vazirmatn', sans-serif;
    color: #fff;
    background-color: #552575;
    border-color: #552575;
}

.btn-primary:hover {
    background-color: #441e5e;
    border-color: #441e5e;
}

.btn-danger {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-secondary {
    font-family: 'Vazirmatn', sans-serif;
    /* Added secondary button style */
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}


/* Customer Panel Specific Styles */
.customer-panel h3 {
    font-size: 1.3em;
    color: #333;
    margin-top: 1.5em;
    margin-bottom: 1em;
}

.booking-cards-container {
    display: grid;
    gap: 1.5em;
}

.booking-card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease;
}

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

.booking-card .card-header {
    padding: 0.8em 1em;
    background-color: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.booking-card .order-number {
    font-weight: bold;
    color: #552575;
}

.booking-card .booking-status {
    font-size: 0.9em;
    padding: 0.25em 0.6em;
    border-radius: 10px;
    font-weight: 500;
}

.booking-card .card-body {
    padding: 1em;
    flex-grow: 1;
    /* Allows body to take up space */
}

.booking-card .card-body p {
    margin: 0 0 0.6em 0;
    font-size: 0.95em;
    line-height: 1.5;
}

.booking-card .card-body p strong {
    color: #444;
}

.booking-card .card-footer {
    padding: 0.8em 1em;
    background-color: #f9f9f9;
    border-top: 1px solid #e0e0e0;
    font-size: 0.9em;
    color: #555;
    display: flex;
    justify-content: space-between;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

.no-bookings {
    text-align: center;
    padding: 3em 1em;
    color: #777;
    background-color: #f9f9f9;
    border-radius: 6px;
    font-size: 1.1em;
}

.no-bookings a {
    color: #552575;
    font-weight: bold;
}

/* Status specific text colors */
.status-text-paid {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-text-confirmed {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.status-text-in_progress {
    background-color: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
}

.status-text-completed {
    background-color: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

.status-text-cancelled {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-text-failed {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Status specific border colors for cards (e.g., left border) */
.status-border-paid {
    border-left: 5px solid #28a745;
}

.status-border-confirmed {
    border-left: 5px solid #17a2b8;
}

.status-border-in_progress {
    border-left: 5px solid #007bff;
}

.status-border-completed {
    border-left: 5px solid #6c757d;
}

.status-border-cancelled {
    border-left: 5px solid #dc3545;
}

.status-border-failed {
    border-left: 5px solid #dc3545;
}


.site-footer {
    /* Used in customer_panel.php */
    text-align: center;
    padding: 1.5em 0;
    background-color: #333;
    color: white;
    width: 100%;
    margin-top: auto;
    /* Pushes footer to bottom if content is short */
}

.site-footer p {
    margin: 0;
}

/* Service Selection Styles */
#openServicesModalBtn {
    display: inline-block;
    /* Align with label */
    margin-top: 0.5em;
    /* Space from label */
    width: auto;
    /* Don't make it full width */
    padding: 0.6em 1.2em;
    /* Adjust padding */
}

.selected-services-display {
    margin-top: 0.8em;
    padding: 0.8em;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    min-height: 40px;
    /* Ensure it has some height even when empty */
    font-size: 0.95em;
    color: #555;
}

/* Modal Styles */
.modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    /* Stay in place */
    z-index: 1000;
    /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    /* Full width */
    height: 100%;
    /* Full height */
    overflow: auto;
    /* Enable scroll if needed */
    background-color: rgba(0, 0, 0, 0.5);
    /* Black w/ opacity */
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    /* 10% from the top and centered */
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    /* Could be more or less, depending on screen size */
    max-width: 600px;
    /* Maximum width */
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    /* Limit height */
    box-sizing: border-box;
    /* Ensure padding/border included in width */
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    color: #552575;
}

.close-btn {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

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

.modal-body {
    padding: 15px 0;
    flex-grow: 1;
    /* Allow body to take up space */
    overflow-y: auto;
    /* Enable vertical scroll for service list */
}

#serviceSearchInput {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: 'Vazirmatn', sans-serif;
}

.service-item {
    display: flex;
    align-items: center;
    padding: 8px 5px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.service-item:last-child {
    border-bottom: none;
}

.service-item:hover {
    background-color: #f9f9f9;
}

.service-item input[type="checkbox"] {
    margin-left: 10px;
    /* RTL: margin-right */
    cursor: pointer;
    /* Larger checkboxes for easier clicking */
    width: 18px;
    height: 18px;
}

.service-item label {
    flex-grow: 1;
    cursor: pointer;
    font-size: 0.95em;
    display: flex;
    /* Use flex to align name and price */
    justify-content: space-between;
    /* Push price to the end */
    align-items: center;
}

.service-item .service-price {
    font-size: 0.9em;
    color: #666;
    margin-right: 10px;
    /* RTL: margin-left */
    white-space: nowrap;
    /* Prevent price from wrapping */
}

.modal-footer {
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    /* Align buttons to the right (end in LTR) */
    gap: 10px;
}

.otp-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-direction: row;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .booking-cards-container {
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    }

    .site-header .header-container {
        flex-direction: row;
        /* Keep horizontal on medium screens */
        align-items: center;
    }

    .site-header .top-nav {
        margin-top: 0;
        /* Reset margin if previously stacked */
    }
}

@media (max-width: 768px) {
    body {
        font-size: 15px;
        /* Adjust base font size for tablets */
    }

    header h1,
    .site-header h1 a {
        font-size: 2em;
    }

    .top-nav a,
    .site-header .top-nav a {
        margin: 0 0.5em;
        padding: 0.3em 0.5em;
    }

    main,
    .panel-container {
        width: 90%;
        padding: 2em;
        margin: 1.5em auto;
    }

    .form-group input[type="text"],
    .form-group input[type="tel"],
    .form-group textarea,
    .form-group select {
        padding: 0.8em;
    }

    .form-group button {
        padding: 0.8em 1.5em;
        font-size: 1em;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .panel-header h2 {
        margin-bottom: 0.5em;
        font-size: 1.4em;
        width: 100%;
        /* Ensure h2 takes full width if needed */
    }

    /* More specific selector for the button container div */
    .panel-container .panel-header>div {
        margin-top: 0.5em;
        width: 100%;
        display: flex;
        flex-direction: column !important;
        /* Ensure column layout */
        gap: 0.5em;
    }

    .panel-container .panel-header>div .btn {
        display: block;
        width: 100% !important;
        /* Ensure full width */
        margin-left: 0;
        text-align: center;
        box-sizing: border-box;
        /* Include padding and border in the element's total width and height */
    }

    .panel-container .panel-header>div .btn:last-child {
        margin-bottom: 0;
    }

    .site-header .header-container {
        flex-direction: column;
        /* Stack header items */
        padding: 0 1em;
    }

    .site-header .top-nav {
        margin-top: 0.8em;
        width: 100%;
    }

    .site-header .top-nav a {
        display: block;
        margin: 0.4em 0;
        text-align: center;
        padding: 0.5em;
        background-color: rgba(255, 255, 255, 0.1);
    }

    .site-header .top-nav a:hover,
    .site-header .top-nav a.active {
        background-color: rgba(255, 255, 255, 0.25);
    }

    .booking-cards-container {
        grid-template-columns: 1fr;
        /* Single column for cards */
        gap: 1em;
    }

    .booking-card .card-header,
    .booking-card .card-body,
    .booking-card .card-footer {
        padding: 0.8em;
    }

    .booking-card .card-body p {
        font-size: 0.9em;
    }

    /* Modal adjustments for smaller screens */
    .modal-content {
        width: 90%;
        margin: 5% auto;
        /* Adjust margin */
        max-height: 90vh;
    }
}

@media (max-width: 600px) {
    body {
        font-size: 14px;
        /* Further adjust base font size for smaller mobiles */
    }

    header {
        padding: 1em 0;
    }

    header h1,
    .site-header h1 a {
        font-size: 1.6em;
        /* Reduce header font size */
        margin-bottom: 0.2em;
    }

    .top-nav {
        /* For non-site-header nav, if any */
        margin-top: 0.3em;
    }

    .top-nav a {
        display: block;
        margin: 0.2em 0;
        text-align: center;
    }

    main,
    .panel-container {
        width: 95%;
        padding: 1em;
        /* Reduce padding */
        margin: 1em auto;
        box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08);
    }

    h2 {
        font-size: 1.4em;
        /* Reduce general h2 size */
        margin-bottom: 0.8em;
    }

    .form-group {
        margin-bottom: 1.2em;
    }

    .otp-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .inline-form-group {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
        /* Space between items */
    }

    .form-group label {
        margin-bottom: 0.4em;
        font-size: 0.95em;
    }

    .form-group input[type="text"],
    .form-group input[type="tel"],
    .form-group textarea,
    .form-group select {
        padding: 0.7em;
        font-size: 0.95em;
    }

    .form-group button {
        width: 100%;
        /* Make button full width */
        padding: 0.8em 1em;
        font-size: 1em;
        min-width: auto;
        /* Remove min-width */
    }

    #openServicesModalBtn {
        /* Override full width for this specific button */
        width: auto;
        display: inline-block;
    }

    .form-group small {
        font-size: 0.85em;
    }

    #map {
        height: 250px;
        /* Reduce map height */
    }

    .message-banner {
        padding: 0.8em;
        margin-bottom: 1em;
        font-size: 0.9em;
    }

    .site-header h1 a {
        font-size: 1.5em;
        /* Specific adjustment for site header logo/title */
    }

    .panel-header h2 {
        font-size: 1.3em;
        /* Adjust panel titles */
    }

    .btn {
        /* General button adjustments */
        padding: .4rem .8rem;
        font-size: 0.9rem;
    }

    .customer-panel h3 {
        font-size: 1.1em;
    }

    .booking-card .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3em;
    }

    .booking-card .order-number {
        font-size: 1em;
    }

    .booking-card .booking-status {
        font-size: 0.8em;
        align-self: flex-start;
    }

    .booking-card .card-body p {
        font-size: 0.9em;
        margin-bottom: 0.5em;
    }

    .booking-card .card-footer {
        font-size: 0.85em;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4em;
    }

    .no-bookings {
        padding: 2em 1em;
        font-size: 1em;
    }

    footer,
    .site-footer {
        padding: 1em 0;
        font-size: 0.9em;
    }

    /* Modal adjustments for smaller screens */
    .modal-content {
        width: 95%;
        margin: 2% auto;
        padding: 15px;
    }

    .modal-header h3 {
        font-size: 1.2em;
    }

    .modal-footer {
        flex-direction: column;
        /* Stack buttons */
        gap: 8px;
    }

    .modal-footer .btn {
        width: 100%;
        /* Make buttons full width */
        font-family: 'Vazirmatn', 'Roboto', sans-serif;
        /* Ensure correct font */
    }
}

@media (max-width: 400px) {

    header h1,
    .site-header h1 a {
        font-size: 1.4em;
    }

    main,
    .panel-container {
        padding: 0.8em;
    }

    h2 {
        font-size: 1.2em;
    }

    .form-group label {
        font-size: 0.9em;
    }

    .form-group input[type="text"],
    .form-group input[type="tel"],
    .form-group textarea,
    .form-group select,
    .form-group button {
        font-size: 0.9em;
    }

    #openServicesModalBtn {
        /* Override full width for this specific button */
        width: auto;
        display: inline-block;
    }

    #map {
        height: 200px;
    }

    .service-item label {
        font-size: 0.9em;
    }

    .service-item .service-price {
        font-size: 0.85em;
    }

    .modal-content {
        /* Further adjustments for very small screens */
        width: 98%;
        padding: 10px;
        margin: 1% auto;
    }

    .modal-header h3 {
        font-size: 1.1em;
    }
}