:root {
    /* Colors */
    --primary-color: #2c3e50; /* Navy Blue */
    --secondary-color: #f1c40f; /* Gold */
    --accent-color: #3498db; /* Blue */
    --background-color: #f4f4f9;
    --card-background: #ffffff;
    --text-color: #333333;
    --text-light: #7f8c8d;
    --border-color: #dddddd;

    /* Status Colors */
    --status-success-bg: #d4edda;
    --status-success-text: #155724;
    --status-warning-bg: #ffeeba;
    --status-warning-text: #856404;
    --status-danger-bg: #f8d7da;
    --status-danger-text: #721c24;
    --status-info-bg: #bee5eb;
    --status-info-text: #0c5460;

    /* Spacing */
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    
    /* Layout */
    --sidebar-width: 250px;
    --header-height: 60px;
}

/* Base Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--primary-color);
    margin-top: 0;
}

/* Layout Grid */
.admin-wrapper {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background-color: var(--primary-color);
    color: #fff;
    display: flex;
    flex-direction: column;
}

.admin-main {
    padding: var(--spacing-lg);
    overflow-y: auto;
}

/* Customer Layout (Single Column Centered) */
.container {
    max-width: 1000px;
    margin: 20px auto;
    background: var(--card-background);
    padding: var(--spacing-lg);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* Components */

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px; /* Ample touch target */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    transition: background-color 0.2s;
}

.btn-primary { background-color: var(--accent-color); color: #fff; }
.btn-primary:hover { background-color: #2980b9; }

.btn-secondary { background-color: #95a5a6; color: #fff; }
.btn-secondary:hover { background-color: #7f8c8d; }

.btn-success { background-color: #27ae60; color: #fff; }
.btn-success:hover { background-color: #2ecc71; }

.btn-danger { background-color: #e74c3c; color: #fff; }
.btn-danger:hover { background-color: #c0392b; }

.btn-sm { padding: 5px 10px; font-size: 14px; }

/* Forms */
.form-group { margin-bottom: var(--spacing-md); }
label { display: block; margin-bottom: 5px; font-weight: bold; }
input, select, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 16px; /* Prevent zoom on iOS */
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin-top: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* Force scroll on small screens */
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
}

/* Badges */
.badge, .status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
    white-space: nowrap;
}

.status-confirmed, .badge-confirmed { background-color: var(--status-success-bg); color: var(--status-success-text); }
.status-awaiting_quote, .badge-awaiting_quote { background-color: var(--status-warning-bg); color: var(--status-warning-text); }
.status-quoted, .badge-quoted { background-color: var(--status-info-bg); color: var(--status-info-text); }
.status-completed, .badge-completed { background-color: #e2e6ea; color: #383d41; }
.status-cancelled, .badge-cancelled, .status-rejected, .badge-rejected { background-color: var(--status-danger-bg); color: var(--status-danger-text); }
.badge-staff { background-color: var(--primary-color); color: #fff; }
.badge-customer { background-color: var(--accent-color); color: #fff; }

/* Header / Nav */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--spacing-lg);
    height: var(--header-height);
    background-color: var(--primary-color);
    color: white;
}

.admin-brand { font-size: 1.2em; font-weight: bold; display: flex; align-items: center; gap: 10px; }
.admin-brand i { color: var(--secondary-color); }

.nav-toggle { display: none; font-size: 1.5em; cursor: pointer; }

.admin-nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    margin-left: 20px;
    padding: 8px 0;
}
.admin-nav a:hover { color: white; }
.admin-nav a.btn-new-booking {
    background: var(--secondary-color);
    color: var(--primary-color);
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.stat-card {
    background: var(--card-background);
    padding: var(--spacing-md);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-left: 4px solid var(--accent-color);
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    .admin-wrapper {
        display: block; /* Stack Sidebar */
    }

    .admin-sidebar {
        display: none; /* Hidden by default on mobile, toggled via JS if it was a real sidebar */
        /* In this specific current design (admin_header.php uses horizontal top nav), we toggle the nav items */
    }

    .admin-header {
        padding: 0 var(--spacing-md);
    }

    .nav-toggle { display: block; }

    .admin-nav {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background-color: var(--primary-color);
        flex-direction: column;
        padding: var(--spacing-md);
        z-index: 1000;
    }

    .admin-nav.active { display: flex; }

    .admin-nav a {
        margin: 0;
        padding: 12px 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    /* Container padding */
    .container, .admin-main { padding: var(--spacing-md); }

    /* Utility to hide elements on mobile */
    .d-none-mobile, .mobile-hide { display: none !important; }

    /* Card View for Tables on Mobile (Optional, strict horizontal scroll is safer for data density, staying with .table-responsive for now) */
    
    /* Modals */
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }

    /* FullCalendar Mobile Fixes */
    #calendar {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .fc-toolbar {
        flex-wrap: wrap;
        font-size: 0.8rem;
    }

    .auth-card {
        width: 95%;
        margin: 1rem auto;
        padding: 1.5rem;
    }
    
    /* Mobile Full Width Buttons */
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }

    .mobile-stack {
        flex-direction: column;
    }
    
    .mobile-stack .btn, .mobile-stack button, .mobile-stack input {
        width: 100%;
    }
}

/* Desktop Auth Card Override */
@media (min-width: 769px) {
    .auth-card {
        max-width: 500px;
        margin: 5rem auto;
        padding: 2rem;
    }
}

/* Shared Auth/Card Styles */
.auth-card {
    background: var(--card-background);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-radius: 8px;
    width: 90%; /* Mobile default */
    margin: 20px auto; /* Mobile default */
    padding: 1.5rem; /* Mobile default */
}

/* Mobile Search Stack */
.mobile-stack {
    display: flex;
    gap: 10px;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: flex-end;
}

.form-actions .btn, .form-actions a {
    /* Ensure consistent height/padding if needed, though .btn class usually handles it */
}

/* Edit Container */
.edit-container {
    padding: 0 20px;
}

/* Column Utilities */
.time-col {
    width: 80px;
}

.name-col {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px; /* Adjust as needed */
}

.page-padding {
    padding: 20px;
}

/* Form Enhancements */
input, select, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 16px; /* Prevent zoom on iOS */
    margin-bottom: 15px; /* Added spacing */
}

/* Interaction */
.clickable-row {
    cursor: pointer;
    transition: background-color 0.1s;
}
.clickable-row:hover {
    background-color: rgba(0,0,0,0.02);
}

/* Modal Styles */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; /* Adjusted from 2000 */
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.5); 
    overflow: auto; /* Enable scroll for modal backdrop if needed */
    /* Removed justify-content and align-items as content is centered via transform */
}

.modal-content {
    background-color: #fff; 
    padding: 20px; /* Adjusted padding to ensure consistent breathing room */
    border-radius: 8px; 
    width: 500px;
    max-width: 90%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    position: absolute; /* Added for transform centering */
    top: 50%; /* Added for transform centering */
    left: 50%; /* Added for transform centering */
    transform: translate(-50%, -50%); /* Added for true centering */
    max-height: 90vh; /* Added to prevent clipping for tall modals */
    overflow-y: auto; /* Added to enable scrolling within the modal content */
}

/* Tabs */
.nav-tabs { display: flex; border-bottom: 2px solid #ddd; margin-bottom: var(--spacing-md); overflow-x: auto; }
.nav-tabs button {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
}
.nav-tabs button.active {
    border-bottom-color: var(--accent-color);
    color: var(--accent-color);
    font-weight: bold;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Auth Button Unification */
.btn-auth {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 12px 0;
    margin-top: 10px;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    font-size: 1rem;
    cursor: pointer;
}