* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #c8102e;
    --secondary-color: #003d7a;
    --accent-color: #ffb81c;
    --text-dark: #333;
    --text-light: #666;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #dee2e6;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.5rem;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

nav a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

nav a:hover {
    opacity: 0.8;
}

/* Main Content */
main {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.card-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #a00d26;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #002d5a;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

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

.btn-warning {
    background-color: var(--warning-color);
    color: var(--text-dark);
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
}

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

.table th {
    background-color: var(--bg-light);
    font-weight: 600;
    color: var(--text-dark);
}

.table tbody tr:hover {
    background-color: var(--bg-light);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Stats Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.stat-card h3 {
    color: #fff; /* Ensure text color is white for better readability */
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-card p {
    font-size: 13px; /* Maintain font size for consistency */
    overflow: visible; /* Allow overflow for better visibility */
}

/* Footer */
footer {
    background-color: var(--text-dark);
    color: white;
    text-align: center;
    opacity: 0.85; /* Maintain opacity for blocked dates */
    z-index: 4; /* Ensure blocked overlays sit on top */
    margin-top: 3rem;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* Calendar Week View */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.calendar-header h3 {
    margin: 0;
}

.calendar-nav {
    display: flex;
    gap: 0.5rem;
}

.calendar-nav button {
    padding: 0.5rem 1rem;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.calendar-nav button:hover {
    background-color: var(--primary-color);
}

.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.calendar-controls button {
    padding: 0.5rem 1rem;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.calendar-controls button:hover {
    background-color: var(--primary-color);
}

.calendar-container {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    gap: 1px;
    background-color: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: visible;
}

.calendar-time-column {
    background-color: var(--bg-light);
    display: flex;
    flex-direction: column;
}

.calendar-time-label {
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-color);
}

.calendar-time-label:first-child {
    height: 50px;
}

.calendar-day-column {
    display: flex;
    flex-direction: column;
    background-color: var(--bg-white);
    position: relative;
    overflow: visible;
    min-height: 1010px;
}

.calendar-day-header {
    height: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    text-align: center;
    background-color: var(--bg-light);
}

.calendar-day-header .weekday {
    display: block;
    color: var(--text-light);
    font-size: 0.7rem;
    text-transform: uppercase;
}

.calendar-day-header .date {
    display: block;
    color: var(--text-dark);
    font-size: 1rem;
    margin-top: 0.1rem;
}

.calendar-day-column.today .calendar-day-header {
    background-color: #e3f2fd;
    border-bottom-color: var(--primary-color);
}

.calendar-day-column.today .date {
    color: var(--primary-color);
    font-weight: bold;
}

.calendar-time-slot {
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
}

.calendar-time-slot:hover {
    background-color: rgba(0, 61, 122, 0.05);
}

.calendar-time-slot.selecting {
    background-color: rgba(0, 61, 122, 0.2);
}

.calendar-time-slot.blocked {
    background-color: #e0e0e0;
    cursor: not-allowed;
    position: relative;
}

.calendar-time-slot.blocked:hover {
    background-color: #d0d0d0;
}

.calendar-time-slot.blocked::after {
    content: 'Blocked by admin';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7rem;
    color: #666;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0.7;
}

.calendar-booking-block {
    position: absolute;
    left: 2px;
    right: 2px;
    background-color: var(--secondary-color);
    color: white;
    padding: 0.3rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: move;
    overflow: visible;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    border-left: 3px solid rgba(255,255,255,0.5);
}

.calendar-booking-block.own-booking {
    background-color: var(--success-color);
    border-left-color: var(--accent-color);
}

.calendar-booking-block.other-booking {
    background-color: #6c757d;
    opacity: 0.85;
}

.calendar-booking-block:hover {
    background-color: var(--primary-color);
    opacity: 1;
}

.calendar-booking-block.dragging {
    opacity: 0.7;
    cursor: grabbing;
}

.calendar-booking-block.resizing {
    cursor: ns-resize;
}

.calendar-booking-time {
    font-weight: 600;
    display: block;
}

.calendar-booking-user {
    display: block;
    opacity: 0.9;
    font-size: 0.7rem;
}

/* Drag and resize handles */
.resize-handle {
    position: absolute;
    left: 0;
    right: 0;
    height: 8px;
    cursor: ns-resize;
    background: rgba(255,255,255,0.3);
    z-index: 10;
}

.resize-handle:hover {
    background: rgba(255,255,255,0.6);
    height: 12px;
}

.resize-handle-top {
    top: 0;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.resize-handle-bottom {
    bottom: 0;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.booking-content {
    cursor: move;
    padding: 4px;
    user-select: none;
}

.calendar-booking-block.own-booking {
    background-color: var(--success-color);
    border: 2px solid #1e7e34;
    cursor: default;
}

.calendar-booking-block.other-booking {
    background-color: #6c757d;
    cursor: default;
}

.calendar-booking-block.admin-booking {
    background-color: var(--secondary-color);
    border-left: 3px solid var(--primary-color);
    cursor: pointer;
}

.calendar-booking-block.admin-booking:hover {
    background-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.calendar-booking-block.blocked-date {
    background-color: #dc3545;
    border-left: 3px solid #a71d2a;
    color: white;
    cursor: pointer;
    opacity: 0.85;
}

.calendar-booking-block.blocked-date:hover {
    opacity: 1;
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.5);
}

.calendar-booking-resize-handle {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8px;
    cursor: ns-resize;
    background: rgba(255,255,255,0.2);
}

.calendar-booking-resize-handle:hover {
    background: rgba(255,255,255,0.4);
}

.booking-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.booking-modal.active {
    display: flex;
}

.booking-modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.booking-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.booking-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.booking-modal-close:hover {
    color: var(--text-dark);
}

/* Responsive */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 1rem;
    }

    nav ul {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .table-actions {
        flex-direction: column;
    }

    .calendar-container {
        grid-template-columns: 50px 1fr;
        overflow-x: auto;
    }

    .calendar-day-column {
        min-width: 120px;
    }

    .calendar-time-label {
        font-size: 0.65rem;
    }
}

/* Responsive */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 1rem;
    }

    nav ul {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .table-actions {
        flex-direction: column;
    }

    .calendar-week {
        grid-template-columns: 1fr;
    }

    .calendar-day {
        min-height: 100px;
    }
}
/* Block dates calendar modal */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-bottom: 1rem;
}

.calendar-day {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.calendar-day:hover {
    border-color: var(--primary-color);
    background: #fef5f6;
}

.calendar-day.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.calendar-day .day-name {
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.calendar-day .day-number {
    font-size: 1.5rem;
    font-weight: bold;
}