/* Admin Panel Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Login Screen */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header h1 {
    color: #2d3748;
    font-size: 24px;
    margin-bottom: 8px;
}

.login-header h2 {
    color: #718096;
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 32px;
}

.login-form .form-group {
    margin-bottom: 24px;
}

.login-form input {
    width: 100%;
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
}

/* Dashboard */
.dashboard-container {
    background: #f7fafc;
    min-height: 100vh;
}

.dashboard-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    color: #2d3748;
    font-size: 24px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.last-updated {
    color: #718096;
    font-size: 14px;
}

/* Statistics Cards */
.stats-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 32px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
}

.stat-content h3 {
    font-size: 28px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 4px;
}

.stat-content p {
    color: #718096;
    font-size: 14px;
    font-weight: 500;
}

/* Rating Card Link Styling */
.rating-card {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.rating-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

.rating-card:hover .stat-icon {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.rating-card:hover .stat-content h3 {
    color: #667eea;
}

.rating-card:hover .stat-content p {
    color: #667eea;
}

/* Controls Section */
.controls-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 32px;
}

.controls-container {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: end;
}

.filter-group, .search-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-weight: 500;
    color: #4a5568;
    font-size: 14px;
}

.filter-group select, .search-group input {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    min-width: 200px;
    transition: border-color 0.3s ease;
}

.filter-group select:focus, .search-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Bookings Section */
.bookings-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    color: #2d3748;
    font-size: 20px;
    font-weight: 600;
}

.real-time-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #718096;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f56565;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: #48bb78;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Table */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.bookings-table {
    width: 100%;
    border-collapse: collapse;
}

.bookings-table th {
    background: #f7fafc;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
    border-bottom: 1px solid #e2e8f0;
}

.bookings-table td {
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
}

.bookings-table tr:hover {
    background: #f7fafc;
}

.loading-cell {
    text-align: center;
    color: #718096;
    padding: 40px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
}

/* Status Badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-new { background: #fed7d7; color: #c53030; }
.status-confirmed { background: #c6f6d5; color: #2f855a; }
.status-in-progress { background: #bee3f8; color: #2b6cb0; }
.status-completed { background: #d6f5d6; color: #276749; }
.status-cancelled { background: #fed7d7; color: #c53030; }

/* Error Message */
.error-message {
    color: #e53e3e;
    font-size: 14px;
    margin-top: 12px;
    padding: 12px;
    background: #fed7d7;
    border-radius: 8px;
    border: 1px solid #feb2b2;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .controls-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group select, .search-group input {
        min-width: auto;
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .bookings-table {
        min-width: 800px;
    }

    .day-checkboxes {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

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

.modal-header h3 {
    color: #2d3748;
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #718096;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.modal-close:hover {
    background: #f7fafc;
}

.modal-body {
    padding: 0 24px;
}

.modal-footer {
    padding: 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid #e2e8f0;
    margin-top: 24px;
}

/* Settings Modal Styles */
.settings-section {
    margin-bottom: 2rem;
}

.settings-section h4 {
    color: #2d3748;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.settings-section p {
    color: #718096;
    margin-bottom: 1rem;
    font-size: 14px;
}

.calendar-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.settings-info {
    margin-top: 16px;
    padding: 12px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.settings-info p {
    margin: 0;
    font-size: 13px;
}

.settings-info p:first-child {
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 4px;
}

.settings-info small {
    color: #718096;
}

#admin-calendar {
    margin: 16px 0;
}

/* Admin calendar specific styling */
.admin-calendar .calendar-component {
    max-width: 100%;
    margin: 0 auto;
}

/* Calendar View Section */
.calendar-view-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.view-toggle {
    display: flex;
    gap: 8px;
}

.view-toggle .btn {
    padding: 8px 16px;
    font-size: 14px;
}

.view-toggle .btn.active {
    background: #4299e1;
    color: white;
}

.calendar-view-container {
    margin-top: 20px;
}

.admin-booking-calendar {
    margin-bottom: 20px;
}

/* Calendar Legend */
.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 16px;
    background: #f7fafc;
    border-radius: 8px;
    margin-top: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #4a5568;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.legend-color.available {
    background: #48bb78;
}

.legend-color.partial {
    background: #f6ad55;
}

.legend-color.booked {
    background: #dc2626; /* Bright red to match booked dates */
}

.legend-color.unavailable {
    background: #a0aec0;
}

/* Customer booking indicators */
.calendar-day.has-booking {
    position: relative;
}

.booking-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 24px;
    height: 24px;
    background: #4299e1;
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.booking-indicator:hover {
    background: #3182ce;
    transform: scale(1.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border-color: #ffd700;
}

.booking-indicator::before {
    content: '👤';
    font-size: 14px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Add a subtle pulse animation to make it more noticeable */
.booking-indicator {
    animation: subtle-pulse 2s infinite;
}

@keyframes subtle-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.booking-indicator:hover {
    animation: none; /* Stop pulsing on hover */
}

/* Booking tooltip */
.booking-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.booking-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #2d3748;
}

.booking-indicator:hover .booking-tooltip {
    opacity: 1;
}

/* Calendar Controls Bar */
.calendar-controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f7fafc;
    border-radius: 8px;
    margin: 16px 0;
    gap: 16px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-weight: 500;
    color: #4a5568;
    font-size: 14px;
}

.control-group .form-control {
    min-width: 160px;
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
}

.calendar-instructions {
    background: #e6fffa;
    border: 1px solid #81e6d9;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.calendar-instructions p {
    margin: 0;
    color: #234e52;
    font-size: 14px;
}

.calendar-stats {
    text-align: center;
    padding: 12px;
    background: #f7fafc;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
    color: #4a5568;
}

.calendar-stats p {
    margin: 0;
}

/* Calendar day states for multiple bookings */
.calendar-day.partially-booked {
    background: #f6ad55 !important;
    color: white;
}

.calendar-day.booked {
    background: #dc2626 !important; /* Bright red for booked dates */
    color: white !important;
    font-weight: bold !important;
}

/* Admin clickable dates - override any pointer-events: none */
.admin-booking-calendar .calendar-day.admin-clickable {
    cursor: pointer !important;
    transition: all 0.2s ease;
    position: relative;
    pointer-events: auto !important;
}

.admin-booking-calendar .calendar-day.admin-clickable:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

/* Make booked unavailable dates red and clickable in admin mode - HIGHEST SPECIFICITY */
#admin-booking-calendar .calendar-day.unavailable.admin-clickable.booked,
.admin-booking-calendar .calendar-day.unavailable.admin-clickable.booked,
.calendar-view-container .calendar-day.unavailable.admin-clickable.booked {
    border: 4px dashed #dc2626 !important;
    background: #fef2f2 !important;
    color: #991b1b !important;
    font-weight: 900 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    opacity: 1 !important;
    box-shadow: 0 0 0 2px #fca5a5 !important;
}

/* Make non-booked unavailable dates grey and clickable in admin mode */
#admin-booking-calendar .calendar-day.unavailable.admin-clickable:not(.booked),
.admin-booking-calendar .calendar-day.unavailable.admin-clickable:not(.booked),
.calendar-view-container .calendar-day.unavailable.admin-clickable:not(.booked) {
    border: 3px solid #e5e7eb !important;
    background: #f9fafb !important;
    color: #6b7280 !important;
    font-weight: 600 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    opacity: 1 !important;
    box-shadow: 0 0 0 1px #d1d5db !important;
}

/* Hover styles for booked unavailable dates */
#admin-booking-calendar .calendar-day.unavailable.admin-clickable.booked:hover,
.admin-booking-calendar .calendar-day.unavailable.admin-clickable.booked:hover,
.calendar-view-container .calendar-day.unavailable.admin-clickable.booked:hover {
    border: 4px solid #2563eb !important;
    background: #dbeafe !important;
    color: #1e40af !important;
    transform: scale(1.2) !important;
    box-shadow: 0 0 0 3px #93c5fd, 0 8px 16px rgba(37, 99, 235, 0.5) !important;
    z-index: 100 !important;
}

/* Hover styles for non-booked unavailable dates */
#admin-booking-calendar .calendar-day.unavailable.admin-clickable:not(.booked):hover,
.admin-booking-calendar .calendar-day.unavailable.admin-clickable:not(.booked):hover,
.calendar-view-container .calendar-day.unavailable.admin-clickable:not(.booked):hover {
    border: 3px solid #2563eb !important;
    background: #dbeafe !important;
    color: #1e40af !important;
    transform: scale(1.1) !important;
    box-shadow: 0 0 0 2px #93c5fd, 0 4px 8px rgba(37, 99, 235, 0.3) !important;
    z-index: 100 !important;
}

/* Add a subtle admin indicator */
.calendar-day.admin-clickable::after {
    content: '⚙️';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 8px;
    opacity: 0.5;
}

.calendar-day.admin-clickable:hover::after {
    opacity: 1;
}

/* Hide table view when calendar is active */
.calendar-view-active .bookings-section {
    display: none;
}
