/* =============================================
   نظام إدارة الشقق الفندقية
   Apart Otel Yönetim Sistemi
   ============================================= */

:root {
    --brand-primary: #1a5c3a;
    --brand-primary-light: #2d8a5e;
    --brand-primary-dark: #0e3d25;
    --brand-accent: #c8a45c;
    --brand-accent-light: #e0c882;
    --bg-body: #f0ece4;
    --bg-card: #ffffff;
    --bg-sidebar: #0e1f16;
    --bg-sidebar-hover: #1a3528;
    --text-primary: #1a1a1a;
    --text-secondary: #5a5a5a;
    --text-muted: #8a8a8a;
    --text-on-dark: #f0ece4;
    --text-on-brand: #ffffff;
    --status-available: #2d8a5e;
    --status-booked: #c0392b;
    --status-partial: #e67e22;
    --status-full: #95a5a6;
    --border-color: #e0dcd4;
    --border-radius: 10px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --sidebar-width: 260px;
    --topbar-height: 64px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; }
body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* SIDEBAR */
.sidebar {
    position: fixed; top: 0; width: var(--sidebar-width); height: 100vh;
    background: var(--bg-sidebar); z-index: 100; display: flex; flex-direction: column;
    transition: transform 0.3s;
}
html[dir="rtl"] .sidebar { right: 0; border-left: 1px solid rgba(255,255,255,0.05); }
html[dir="ltr"] .sidebar { left: 0; border-right: 1px solid rgba(255,255,255,0.05); }

.sidebar-brand {
    padding: 28px 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); text-align: center;
}
.brand-icon { font-size: 2.2rem; margin-bottom: 6px; }
.sidebar-brand h2 { color: var(--brand-accent); font-size: 1.3rem; font-weight: 800; }
.brand-sub { color: rgba(255,255,255,0.35); font-size: 0.72rem; letter-spacing: 2px; text-transform: uppercase; }
.nav-links { list-style: none; padding: 16px 12px; flex: 1; overflow-y: auto; }
.nav-links li a {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    color: rgba(255,255,255,0.6); text-decoration: none; border-radius: 8px;
    font-size: 0.95rem; font-weight: 500; transition: all 0.2s; margin-bottom: 2px;
}
.nav-links li a:hover { background: var(--bg-sidebar-hover); color: rgba(255,255,255,0.9); }
.nav-links li.active a {
    background: var(--brand-primary); color: #fff; font-weight: 700;
    box-shadow: 0 2px 8px rgba(26,92,58,0.4);
}
.nav-icon { font-size: 1.15rem; }

/* MAIN CONTENT */
.main-content { min-height: 100vh; }
html[dir="rtl"] .main-content { margin-right: var(--sidebar-width); }
html[dir="ltr"] .main-content { margin-left: var(--sidebar-width); }

.top-bar {
    height: var(--topbar-height); background: var(--bg-card);
    border-bottom: 1px solid var(--border-color); display: flex;
    align-items: center; padding: 0 32px; gap: 20px; position: sticky; top: 0; z-index: 50;
}
.menu-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-primary); }
.page-title { font-size: 1.2rem; font-weight: 700; flex: 1; }
.top-bar-actions { display: flex; align-items: center; gap: 12px; }
.date-display {
    color: var(--text-muted); font-size: 0.85rem; font-weight: 500;
    background: var(--bg-body); padding: 6px 14px; border-radius: 20px;
}
.content-area { padding: 28px 32px; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card {
    background: var(--bg-card); border-radius: var(--border-radius); padding: 24px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-icon { font-size: 2rem; margin-bottom: 12px; }
.stat-card .stat-value { font-size: 2rem; font-weight: 900; color: var(--brand-primary); line-height: 1; }
.stat-card .stat-label { color: var(--text-secondary); font-size: 0.85rem; margin-top: 6px; font-weight: 500; }

/* PANEL */
.panel {
    background: var(--bg-card); border-radius: var(--border-radius); box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color); margin-bottom: 24px; overflow: hidden;
}
.panel-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.panel-header h2 { font-size: 1.1rem; font-weight: 700; }
.panel-body { padding: 24px; }

/* FORMS */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-weight: 600; font-size: 0.85rem; color: var(--text-secondary); }
.form-group input, .form-group select, .form-group textarea {
    padding: 10px 14px; border: 1.5px solid var(--border-color); border-radius: 8px;
    font-family: inherit; font-size: 0.95rem; background: var(--bg-body);
    color: var(--text-primary); transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--brand-primary); background: #fff;
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* BUTTONS */
.btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px; border: none;
    border-radius: 8px; font-family: inherit; font-size: 0.9rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s; text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-primary-dark); box-shadow: 0 4px 12px rgba(26,92,58,0.3); }
.btn-accent { background: var(--brand-accent); color: #1a1a1a; }
.btn-accent:hover { background: var(--brand-accent-light); }
.btn-outline { background: transparent; border: 1.5px solid var(--border-color); color: var(--text-primary); }
.btn-outline:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.btn-danger { background: #c0392b; color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-group { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

/* TABLES */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 12px 16px; font-size: 0.9rem; border-bottom: 1px solid var(--border-color); }
table th {
    background: var(--bg-body); font-weight: 700; font-size: 0.8rem;
    color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px;
}
table tr:hover td { background: rgba(45,138,94,0.03); }
table .actions { display: flex; gap: 6px; }

/* FILTER BAR */
.filter-bar {
    display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 20px;
    padding: 16px 20px; background: var(--bg-body); border-radius: 8px;
}
.filter-bar .form-group { min-width: 160px; gap: 4px; }
.filter-bar input, .filter-bar select {
    padding: 8px 12px; border: 1.5px solid var(--border-color); border-radius: 8px;
    font-family: inherit; font-size: 0.85rem; background: #fff;
}

/* CALENDAR */
.calendar-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.calendar-nav { display: flex; align-items: center; gap: 12px; }
.calendar-nav .month-label { font-size: 1.3rem; font-weight: 800; color: var(--brand-primary-dark); min-width: 200px; text-align: center; }
.calendar-nav .btn { padding: 8px 16px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; direction: ltr; }
.calendar-grid .day-header {
    padding: 10px 4px; text-align: center; font-weight: 700; font-size: 0.8rem;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px;
}
.calendar-grid .day-cell {
    min-height: 90px; background: var(--bg-card); border-radius: 8px; padding: 8px;
    border: 1.5px solid var(--border-color); transition: all 0.2s; cursor: pointer; position: relative;
}
.calendar-grid .day-cell:hover { border-color: var(--brand-primary-light); box-shadow: var(--shadow-sm); }
.calendar-grid .day-cell.empty { background: transparent; border-color: transparent; cursor: default; }
.calendar-grid .day-cell.today { border-color: var(--brand-accent); box-shadow: 0 0 0 2px rgba(200,164,92,0.3); }
.day-number { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); margin-bottom: 6px; }
.day-availability { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.avail-badge {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    width: 100%; padding: 4px 6px; border-radius: 6px; font-size: 0.72rem; font-weight: 700; text-align: center;
}
.avail-badge.available { background: var(--status-available); color: #fff; }
.avail-badge.booked { background: var(--status-booked); color: #fff; }
.avail-badge.full-avail { background: rgba(45,138,94,0.12); color: var(--status-available); }
.avail-count { font-size: 1.1rem; font-weight: 900; display: block; line-height: 1; }

/* VOUCHER */
.voucher-container { max-width: 800px; margin: 0 auto; background: #fff; border: 2px solid var(--brand-primary); border-radius: 12px; overflow: hidden; }
.voucher-header { background: var(--brand-primary); color: #fff; padding: 28px 32px; display: flex; justify-content: space-between; align-items: center; }
.voucher-header h1 { font-size: 1.6rem; font-weight: 900; }
.voucher-header .voucher-type { font-size: 0.9rem; background: rgba(255,255,255,0.2); padding: 6px 16px; border-radius: 20px; font-weight: 600; }
.voucher-body { padding: 32px; }
.voucher-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }
.voucher-field { display: flex; flex-direction: column; gap: 4px; }
.voucher-field .field-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.voucher-field .field-value { font-size: 1rem; font-weight: 600; }
.voucher-table { width: 100%; border-collapse: collapse; margin: 20px 0; }
.voucher-table th { background: var(--bg-body); padding: 10px 14px; font-weight: 700; font-size: 0.8rem; }
.voucher-table td { padding: 10px 14px; border-bottom: 1px solid var(--border-color); font-size: 0.9rem; }
.voucher-total { display: flex; margin-top: 20px; }
html[dir="rtl"] .voucher-total { justify-content: flex-start; }
html[dir="ltr"] .voucher-total { justify-content: flex-end; }
.voucher-total-box { background: var(--bg-body); padding: 16px 28px; border-radius: 8px; min-width: 260px; }
.voucher-total-row { display: flex; justify-content: space-between; gap: 40px; padding: 6px 0; font-size: 0.9rem; }
.voucher-total-row.grand { border-top: 2px solid var(--brand-primary); padding-top: 10px; margin-top: 6px; font-weight: 900; font-size: 1.1rem; color: var(--brand-primary); }
.voucher-footer { background: var(--bg-body); padding: 20px 32px; text-align: center; font-size: 0.8rem; color: var(--text-muted); border-top: 1px solid var(--border-color); }
.voucher-actions { display: flex; gap: 12px; justify-content: center; margin-top: 24px; }

/* BADGES */
.badge { display: inline-block; padding: 4px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 700; }
.badge-confirmed { background: rgba(45,138,94,0.12); color: var(--status-available); }
.badge-checked_in { background: rgba(52,152,219,0.12); color: #2980b9; }
.badge-checked_out { background: rgba(149,165,166,0.15); color: #7f8c8d; }
.badge-cancelled { background: rgba(192,57,43,0.12); color: var(--status-booked); }

/* MODAL */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal { background: var(--bg-card); border-radius: 12px; max-width: 600px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; gap: 10px; }

/* ALERT */
.alert { padding: 14px 20px; border-radius: 8px; margin-bottom: 20px; font-weight: 500; font-size: 0.9rem; }
.alert-success { background: rgba(45,138,94,0.1); color: var(--brand-primary); border: 1px solid rgba(45,138,94,0.2); }
.alert-error { background: rgba(192,57,43,0.1); color: #c0392b; border: 1px solid rgba(192,57,43,0.2); }
.alert-info { background: rgba(52,152,219,0.1); color: #2980b9; border: 1px solid rgba(52,152,219,0.2); }

/* PRINT */
@media print {
    .sidebar, .top-bar, .voucher-actions, .btn, .no-print { display: none !important; }
    .main-content { margin: 0 !important; }
    .content-area { padding: 0 !important; }
    .voucher-container { border: 1px solid #333; }
}

/* RESPONSIVE */
@media (max-width: 900px) {
    html[dir="rtl"] .sidebar { transform: translateX(100%); }
    html[dir="ltr"] .sidebar { transform: translateX(-100%); }
    html[dir="rtl"] body.sidebar-open .sidebar { transform: translateX(0); }
    html[dir="ltr"] body.sidebar-open .sidebar { transform: translateX(0); }
    .main-content { margin-right: 0 !important; margin-left: 0 !important; }
    .menu-toggle { display: block; }
    .content-area { padding: 20px 16px; }
    .calendar-grid .day-cell { min-height: 70px; padding: 6px; }
    .avail-badge { font-size: 0.65rem; }
    .voucher-info-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat-card { padding: 16px; }
    .stat-card .stat-value { font-size: 1.5rem; }
    .form-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; }
    .filter-bar .form-group { min-width: 100%; }
}
