/* =====================================================
   LHotel - Modern Hotel Booking System
   Clean, Professional Design
   ===================================================== */

/* CSS Variables */
:root {
    /* Primary Colors */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --primary-bg: #eff6ff;

    /* Neutral Colors */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Accent Colors */
    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --info: #06b6d4;
    --info-bg: #cffafe;

    /* Booking Colors */
    --booking-direct: #fecaca;
    --booking-tour: #bfdbfe;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Transitions */
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* =====================================================
   Sidebar
   ===================================================== */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--gray-900) 0%, var(--gray-800) 100%);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 32px;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--gray-400);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 16px 0;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-500);
    padding: 8px 16px;
    font-weight: 600;
}

/* =====================================================
   Main Content
   ===================================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-header {
    background: white;
    padding: 20px 32px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.5px;
}

.content-wrapper {
    padding: 32px;
    flex: 1;
}

/* =====================================================
   Cards
   ===================================================== */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

/* =====================================================
   Forms
   ===================================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-input,
.form-select,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="email"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--gray-900);
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    outline: none;
}

.form-input:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-input::placeholder,
input::placeholder {
    color: var(--gray-400);
}

.form-input-sm {
    padding: 8px 12px;
    font-size: 13px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

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

.form-row-3 {
    grid-template-columns: repeat(3, 1fr);
}

.form-row-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.form-check-label {
    font-size: 14px;
    color: var(--gray-700);
    user-select: none;
}

/* =====================================================
   Buttons
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-300);
}

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

.btn-success:hover:not(:disabled) {
    background: #059669;
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover:not(:disabled) {
    background: var(--gray-100);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 10px;
}

/* =====================================================
   Tables
   ===================================================== */
.table-wrapper {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background: var(--gray-50);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-600);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table-striped tbody tr:nth-child(even) {
    background: var(--gray-50);
}

/* =====================================================
   Badges
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-primary {
    background: var(--primary-bg);
    color: var(--primary);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

/* =====================================================
   Alerts
   ===================================================== */
.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert-info {
    background: var(--info-bg);
    color: #0891b2;
}

.alert-success {
    background: var(--success-bg);
    color: #059669;
}

.alert-warning {
    background: var(--warning-bg);
    color: #d97706;
}

.alert-danger {
    background: var(--danger-bg);
    color: #dc2626;
}

/* =====================================================
   Stats Cards
   ===================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
    margin-top: 8px;
    line-height: 1;
}

.stat-value.primary { color: var(--primary); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }
.stat-value.danger { color: var(--danger); }

.stat-subtitle {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 8px;
}

/* =====================================================
   Guest Form (Booking)
   ===================================================== */
.guest-card {
    background: var(--gray-50);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--gray-200);
}

.guest-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.guest-number {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
}

.guest-number span {
    background: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.guest-meals {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* =====================================================
   Range Slider
   ===================================================== */
.range-slider {
    display: flex;
    align-items: center;
    gap: 16px;
}

.range-slider input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: var(--gray-200);
    outline: none;
    -webkit-appearance: none;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: var(--shadow);
}

.range-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    min-width: 30px;
}

/* =====================================================
   Calendar
   ===================================================== */
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
}

.calendar-nav h2 {
    font-size: 20px;
    font-weight: 600;
    min-width: 200px;
    text-align: center;
}

.calendar-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.calendar-table th,
.calendar-table td {
    border: 1px solid var(--gray-300);
    text-align: center;
    font-size: 12px;
}

.calendar-table th {
    background: var(--gray-800);
    color: white;
    font-weight: 500;
    padding: 6px 2px;
}

.calendar-table th.room-header {
    background: var(--gray-900);
    min-width: 50px;
}

.calendar-table td.room-cell {
    background: var(--gray-100);
    font-weight: 600;
    text-align: center;
    padding: 0 4px;
}

/* Пустая ячейка */
.calendar-table .empty-cell {
    height: 36px;
    min-width: 32px;
}

/* Ячейка бронирования */
.calendar-table .booking-cell {
    position: relative;
    height: 36px;
    padding: 0;
    overflow: hidden;
}

.calendar-table .booking-cell.direct {
    background: var(--booking-direct);
}

.calendar-table .booking-cell.tour {
    background: var(--booking-tour);
}

/* Контент бронирования */
.calendar-table .booking-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* Текст брони */
.calendar-table .booking-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
    text-align: center;
    padding: 0 4px;
}

/* Диагональный срез в день заезда (верхний левый угол) */
.calendar-table .checkin-corner {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 18px 16px 0 0;
    border-color: white transparent transparent transparent;
    z-index: 2;
}

/* Диагональный срез в день выезда (нижний правый угол) */
.calendar-table .checkout-corner {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 18px 16px;
    border-color: transparent transparent white transparent;
    z-index: 2;
}

.legend {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-600);
}

.legend-box {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--gray-300);
}

/* =====================================================
   Seasons
   ===================================================== */
.modifier-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 600;
}

.modifier-high {
    background: var(--danger-bg);
    color: var(--danger);
}

.modifier-normal {
    background: var(--success-bg);
    color: var(--success);
}

.modifier-low {
    background: var(--info-bg);
    color: var(--info);
}

.season-edit-form {
    display: none;
    background: var(--gray-50);
    padding: 20px;
    border-radius: var(--border-radius-sm);
    margin-top: 12px;
}

.season-edit-form.active {
    display: block;
}

/* =====================================================
   Info Box
   ===================================================== */
.info-box {
    background: var(--primary-bg);
    border-left: 4px solid var(--primary);
    padding: 16px 20px;
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    margin-bottom: 24px;
}

.info-box h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
}

.info-box p {
    font-size: 14px;
    color: var(--gray-600);
}

/* =====================================================
   Bookings Table
   ===================================================== */
.booking-number {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-bg);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
}

.booking-guest {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.guest-name {
    font-weight: 500;
    color: var(--gray-800);
}

.badge-tour {
    background: var(--booking-tour);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.badge-transfer {
    background: var(--info);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.room-badge {
    display: inline-block;
    background: var(--gray-100);
    color: var(--gray-700);
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 14px;
}

.date-display {
    color: var(--gray-600);
    font-size: 14px;
}

.sum-display {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 14px;
}

/* Row status colors */
.booking-row-current {
    background: linear-gradient(90deg, var(--success-bg) 0%, transparent 100%) !important;
    border-left: 3px solid var(--success);
}

.booking-row-current td:first-child {
    padding-left: 13px;
}

.booking-row-past {
    opacity: 0.6;
}

.booking-row-past .guest-name {
    color: var(--gray-500);
}

.booking-row-future {
    /* default styling */
}

.booking-row-future:hover {
    background: var(--primary-bg) !important;
}

/* =====================================================
   Utility Classes
   ===================================================== */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 24px; }
.mt-6 { margin-top: 32px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 24px; }
.mb-6 { margin-bottom: 32px; }

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

.text-sm { font-size: 13px; }
.text-lg { font-size: 18px; }

.text-muted { color: var(--gray-500); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.hidden { display: none; }

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition-slow);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .form-row-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 16px;
    }

    .page-header {
        padding: 16px;
    }

    .form-row,
    .form-row-2,
    .form-row-3,
    .form-row-4 {
        grid-template-columns: 1fr;
    }

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

    .calendar-nav {
        flex-direction: column;
        gap: 12px;
    }
}

/* =====================================================
   Print Styles
   ===================================================== */
@media print {
    .sidebar,
    .page-header {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    .content-wrapper {
        padding: 0;
    }
}
