@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #1e3a8a;        /* Deep Navy */
    --primary-light: #2563eb;  /* Royal Blue */
    --primary-hover: #1d4ed8;
    --secondary: #475569;      /* Slate Gray */
    --accent: #0ea5e9;         /* Sky Blue */
    --success: #10b981;        /* Emerald Green */
    --warning: #f59e0b;        /* Amber */
    --danger: #ef4444;         /* Rose Red */
    
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --border: #e2e8f0;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-on-primary: #ffffff;
    
    --font-family: 'Inter', 'Sarabun', sans-serif;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 30px;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 20px -2px rgba(30, 58, 138, 0.08);
    --shadow-lg: 0 10px 30px -5px rgba(30, 58, 138, 0.12);
    
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.4);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --primary: #60a5fa;        /* Light blue for contrast */
    --primary-light: #3b82f6;  
    --primary-hover: #2563eb;
    --secondary: #94a3b8;      
    --accent: #38bdf8;         
    --success: #34d399;        
    --warning: #fbbf24;        
    --danger: #f87171;         
    
    --bg-main: #090d16;
    --bg-card: #151d30;
    --bg-input: #1e293b;
    --border: #243049;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
    
    --glass-bg: rgba(21, 29, 48, 0.8);
    --glass-border: rgba(255, 255, 255, 0.05);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    transition: var(--transition);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* --- LAYOUT & CONTAINERS --- */
.app-container {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: radial-gradient(circle at 10% 20%, rgba(30, 58, 138, 0.15) 0%, rgba(9, 13, 22, 0.02) 90%);
}

.auth-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    padding: 40px;
    transition: var(--transition);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* --- STYLED FORM ELEMENTS --- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-family: var(--font-family);
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-family);
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    gap: 8px;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.25);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background-color: var(--border);
    color: var(--text-primary);
}

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

.btn-danger:hover {
    background-color: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

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

.btn-success:hover {
    background-color: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn-block {
    display: flex;
    width: 100%;
}

/* --- NAVBAR --- */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 40px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background-color: var(--glass-bg);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
}

.nav-brand img {
    height: 36px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
}

.nav-user-avatar {
    width: 32px;
    height: 32px;
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-user-info {
    font-size: 13px;
}

.nav-user-name {
    font-weight: 600;
}

.nav-user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* Toggle Switch for Dark Mode */
.theme-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    background-color: var(--bg-main);
}

/* Sandbox switcher */
.sandbox-badge {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background-color: var(--primary);
    color: white;
    padding: 10px 16px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.1);
}

.sandbox-badge select {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-family: var(--font-family);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}

.sandbox-badge select option {
    background: #1e293b;
    color: white;
}

/* --- CONTENT AREA & DASHBOARDS --- */
.main-content {
    flex: 1;
    padding: 40px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.dashboard-title-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.dashboard-title-area h2 {
    font-size: 26px;
    font-weight: 700;
    position: relative;
    padding-bottom: 8px;
}

.dashboard-title-area h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background-color: var(--primary-light);
    border-radius: 2px;
}

/* Tab menu */
.tab-navigation {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 500;
    font-family: var(--font-family);
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -13px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary);
    border-radius: 3px 3px 0 0;
}

/* --- STAT CARDS (METRICS) --- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 20px;
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.metric-icon.blue { background-color: rgba(37, 99, 235, 0.1); color: var(--primary-light); }
.metric-icon.yellow { background-color: rgba(245, 158, 11, 0.1); color: var(--warning); }
.metric-icon.green { background-color: rgba(16, 185, 129, 0.1); color: var(--success); }
.metric-icon.red { background-color: rgba(239, 68, 68, 0.1); color: var(--danger); }

.metric-info h4 {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
}

/* --- ROOMS VIEW --- */
.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

.room-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.room-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.room-img-container {
    position: relative;
    height: 180px;
    width: 100%;
    overflow: hidden;
}

.room-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.room-card:hover .room-img {
    transform: scale(1.05);
}

.room-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-xl);
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.15);
}

.room-badge.maintenance {
    background-color: rgba(239, 68, 68, 0.85);
}

.room-details {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.room-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.room-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.room-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.room-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 16px;
    flex: 1;
}

.room-amenities {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.amenity-tag {
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

.room-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

/* --- BADGES --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-xl);
    font-size: 12px;
    font-weight: 600;
    gap: 5px;
}

.status-badge.pending {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status-badge.approved {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.rejected {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.status-badge.cancelled {
    background-color: var(--border);
    color: var(--text-secondary);
}

/* --- TABLES --- */
.table-responsive {
    overflow-x: auto;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.table-custom th, .table-custom td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.table-custom th {
    background-color: var(--bg-main);
    font-weight: 600;
    color: var(--text-secondary);
}

.table-custom tr:last-child td {
    border-bottom: none;
}

.table-custom tbody tr:hover {
    background-color: rgba(30, 58, 138, 0.02);
}

/* --- MODAL DIALOGS --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-secondary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background-color: var(--bg-main);
}

/* Checklist for amenities */
.amenities-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 5px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input {
    cursor: pointer;
}

/* --- CALENDAR INTEGRATION STYLES --- */
.calendar-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
}

/* Override FullCalendar variables to match our theme */
.fc {
    --fc-border-color: var(--border);
    --fc-today-bg-color: rgba(37, 99, 235, 0.05);
    --fc-button-bg-color: var(--bg-main);
    --fc-button-border-color: var(--border);
    --fc-button-text-color: var(--text-primary);
    --fc-button-hover-bg-color: var(--border);
    --fc-button-hover-border-color: var(--border);
    --fc-button-active-bg-color: var(--primary);
    --fc-button-active-border-color: var(--primary);
    --fc-button-active-text-color: var(--text-on-primary);
    font-family: var(--font-family) !important;
}

.fc-theme-standard td, .fc-theme-standard th {
    border-color: var(--border) !important;
}

.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.fc-event {
    cursor: pointer;
    border: none !important;
    padding: 2px 6px;
    border-radius: 4px;
}

/* --- ANALYTICS DASHBOARD LAYOUT --- */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 24px;
    margin-top: 30px;
}

@media (max-width: 992px) {
    .analytics-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.chart-card h3 {
    font-size: 16px;
    margin-bottom: 20px;
    color: var(--text-primary);
    font-weight: 600;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Form switch for login/register link */
.form-link-text {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 20px;
}

.form-link-text a {
    color: var(--primary-light);
    font-weight: 600;
    text-decoration: none;
}

.form-link-text a:hover {
    text-decoration: underline;
}

/* Conflict Warning */
.warning-message {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(239, 68, 68, 0.08);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    border: 1px solid rgba(239, 68, 68, 0.15);
    margin-top: 10px;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 360px;
    width: 100%;
}

.toast {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 5px solid var(--primary-light);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

.toast-icon {
    font-size: 20px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.toast-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
}

/* User Account details layout */
.profile-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 24px;
    align-items: center;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background-color: var(--primary);
    color: white;
    font-size: 32px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-details h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
}

.profile-details p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.profile-details p span {
    font-weight: 600;
    color: var(--text-primary);
}

/* Responsive fixes */
@media (max-width: 768px) {
    .navbar {
        padding: 15px 20px;
    }
    
    .nav-user-info {
        display: none;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .dashboard-title-area {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .profile-card {
        grid-template-columns: 1fr;
        text-align: center;
        justify-items: center;
    }
}
