/* ========================================
   MODERN HOTEL MANAGEMENT SYSTEM - CSS
   Inspired by Metronic Dashboard
   ======================================== */

:root {
    /* Colors */
    --primary: #3699FF;
    --success: #1BC5BD;
    --danger: #F64E60;
    --warning: #FFA800;
    --info: #8950FC;
    --dark: #181C32;
    --light: #F3F6F9;
    --white: #FFFFFF;
    --gray-100: #F3F6F9;
    --gray-200: #EBEDF3;
    --gray-300: #E4E6EF;
    --gray-400: #D1D3E0;
    --gray-500: #B5B5C3;
    --gray-600: #7E8299;
    --gray-700: #5E6278;
    --gray-800: #3F4254;
    --gray-900: #181C32;
    
    /* Sidebar */
    --sidebar-width: 265px;
    --sidebar-bg: #1e1e2d;
    --sidebar-hover: #1b1b28;
    
    /* Shadows */
    --shadow-sm: 0 0.1rem 1rem 0.25rem rgba(0,0,0,0.05);
    --shadow: 0 0.5rem 1.5rem 0.5rem rgba(0,0,0,0.075);
    --shadow-lg: 0 1rem 3rem rgba(0,0,0,0.175);
}

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

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

/* ========== LAYOUT ========== */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ========== SIDEBAR ========== */

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--white);
    text-decoration: none;
}

.sidebar-brand .brand-logo {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
}

.sidebar-brand .brand-name {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-menu {
    padding: 20px 0;
}

.menu-section-title {
    padding: 20px 25px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: var(--gray-400);
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

.menu-item:hover {
    background: var(--sidebar-hover);
    color: var(--white);
}

.menu-item.active {
    background: var(--sidebar-hover);
    color: var(--primary);
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--primary);
}

.menu-item i {
    width: 24px;
    font-size: 18px;
    margin-right: 15px;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--white);
    padding: 10px;
    border-radius: 8px;
    transition: all 0.2s;
}

.user-profile:hover {
    background: var(--sidebar-hover);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info .user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-info .user-role {
    font-size: 12px;
    color: var(--gray-500);
}

/* ========== MAIN CONTENT ========== */

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    background: var(--gray-100);
}

.topbar {
    background: var(--white);
    padding: 20px 30px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 5px;
}

.breadcrumb {
    display: flex;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-600);
}

.breadcrumb a {
    color: var(--gray-600);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--primary);
}

.topbar-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-logout {
    background: var(--danger);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #d63447;
    transform: translateY(-1px);
}

/* ========== CONTENT AREA ========== */

.content {
    padding: 30px;
}

/* ========== CARDS ========== */

.card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 25px;
    overflow: hidden;
}

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

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

.card-body {
    padding: 25px;
}

.card-simple {
    background: var(--white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 25px;
}

/* ========== STATISTICS CARDS ========== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
}

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

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.primary { background: rgba(54, 153, 255, 0.1); color: var(--primary); }
.stat-icon.success { background: rgba(27, 197, 189, 0.1); color: var(--success); }
.stat-icon.danger { background: rgba(246, 78, 96, 0.1); color: var(--danger); }
.stat-icon.warning { background: rgba(255, 168, 0, 0.1); color: var(--warning); }
.stat-icon.info { background: rgba(137, 80, 252, 0.1); color: var(--info); }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 10px;
}

.stat-change {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

.stat-change.up {
    background: rgba(27, 197, 189, 0.1);
    color: var(--success);
}

.stat-change.down {
    background: rgba(246, 78, 96, 0.1);
    color: var(--danger);
}

/* ========== TABLES ========== */

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

table thead {
    background: var(--gray-100);
}

table th {
    padding: 15px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-200);
}

table td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 13px;
    color: var(--gray-800);
}

table tbody tr {
    transition: all 0.2s;
}

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

/* ========== BUTTONS ========== */

.btn,
button[type="submit"],
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-small,
.btn-delete,
.btn-logout {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
}

.btn-primary,
button[type="submit"][name*="add"],
button[type="submit"][name*="create"],
button[type="submit"][name*="edit"],
button[type="submit"][name*="update"],
button[type="submit"]:not([name*="delete"]):not(.btn-secondary):not(.btn-danger) {
    background: var(--primary);
    color: white;
}

.btn-primary:hover,
button[type="submit"]:hover {
    background: #187DE4;
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(54, 153, 255, 0.3);
}

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

.btn-success:hover {
    background: #0BB7AF;
    transform: translateY(-1px);
}

.btn-danger,
.btn-delete,
button[type="submit"][name*="delete"] {
    background: var(--danger);
    color: white;
}

.btn-danger:hover,
.btn-delete:hover {
    background: #d63447;
    transform: translateY(-1px);
}

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

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

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

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

.btn-logout {
    background: var(--danger);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #d63447;
    transform: translateY(-1px);
}

/* ========== BADGES ========== */

.badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.badge-primary { background: rgba(54, 153, 255, 0.1); color: var(--primary); }
.badge-success { background: rgba(27, 197, 189, 0.1); color: var(--success); }
.badge-danger { background: rgba(246, 78, 96, 0.1); color: var(--danger); }
.badge-warning { background: rgba(255, 168, 0, 0.1); color: var(--warning); }
.badge-info { background: rgba(137, 80, 252, 0.1); color: var(--info); }
.badge-light { background: var(--gray-200); color: var(--gray-700); }

/* Status badges - backward compatible */
.status-available, .badge-active { background: rgba(27, 197, 189, 0.1); color: var(--success); }
.status-occupied, .badge-checkedin { background: rgba(54, 153, 255, 0.1); color: var(--primary); }
.status-reserved, .badge-booked { background: rgba(255, 168, 0, 0.1); color: var(--warning); }
.status-maintenance, .badge-canceled, .badge-inactive { background: rgba(246, 78, 96, 0.1); color: var(--danger); }
.badge-paid { background: rgba(27, 197, 189, 0.1); color: var(--success); }
.badge-unpaid { background: rgba(246, 78, 96, 0.1); color: var(--danger); }

/* ========== FORMS ========== */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--gray-800);
    font-size: 13px;
}

.form-group small {
    color: var(--gray-600);
    font-size: 12px;
    display: block;
    margin-top: 5px;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.2s;
    font-family: inherit;
    background: white;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(54, 153, 255, 0.1);
}

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

.form-inline {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.form-inline input,
.form-inline select {
    flex: 1;
    min-width: 150px;
}

.form-inline label {
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
}

/* ========== ALERTS ========== */

.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert.success {
    background: rgba(27, 197, 189, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.alert.error {
    background: rgba(246, 78, 96, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

/* Old class names for compatibility */
.success {
    background: rgba(27, 197, 189, 0.1);
    border-left: 4px solid var(--success);
    color: var(--success);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.error {
    background: rgba(246, 78, 96, 0.1);
    border-left: 4px solid var(--danger);
    color: var(--danger);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* ========== MODALS ========== */

#edit-form,
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
}

#edit-form > div,
.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    margin: auto;
}

.modal-header {
    margin-bottom: 20px;
}

.modal-header h3,
#edit-form h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 20px;
}

/* ========== LOGIN PAGE ========== */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 50px 40px;
    box-shadow: var(--shadow-lg);
    max-width: 450px;
    width: 100%;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 10px;
}

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

/* ========== BACKWARD COMPATIBILITY ========== */

/* Các class cũ vẫn hoạt động */
.box {
    background: var(--white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 25px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 25px;
}

h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 15px;
}

strong {
    font-weight: 600;
}

a {
    color: var(--primary);
}

a:hover {
    color: #187DE4;
}

/* ========== UTILITIES ========== */

.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--gray-600) !important; }

.bg-primary { background: var(--primary) !important; }
.bg-success { background: var(--success) !important; }
.bg-danger { background: var(--danger) !important; }
.bg-light { background: var(--gray-100) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 10px !important; }
.mb-2 { margin-bottom: 20px !important; }
.mb-3 { margin-bottom: 30px !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 10px !important; }
.mt-2 { margin-top: 20px !important; }
.mt-3 { margin-top: 30px !important; }

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

.d-flex { display: flex !important; }
.align-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.gap-1 { gap: 10px !important; }
.gap-2 { gap: 20px !important; }

/* ========== MOBILE MENU TOGGLE ========== */

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 3000;
    width: 45px;
    height: 45px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
}

.mobile-menu-toggle:hover {
    background: #187DE4;
    transform: scale(1.05);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
}

.sidebar-overlay.active {
    display: block;
}

/* ========== RESPONSIVE ========== */

/* Tablet - 992px */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        z-index: 2000;
        transition: left 0.3s ease;
    }
    
    .sidebar.active {
        left: 0;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .topbar {
        padding-left: 80px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .box {
        padding: 20px;
    }
}

/* Mobile - 768px */
@media (max-width: 768px) {
    .topbar {
        padding: 15px 20px 15px 75px;
    }
    
    .topbar h1 {
        font-size: 18px;
    }
    
    .content {
        padding: 15px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .page-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .page-actions .btn {
        width: 100%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .form-inline {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .form-inline input,
    .form-inline select,
    .form-inline .btn {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .box {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    h3 {
        font-size: 16px;
        margin-bottom: 12px;
    }

    /* Tables responsive */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 12px;
        min-width: 600px;
    }

    th, td {
        padding: 10px 8px;
        white-space: nowrap;
    }

    /* Buttons in table */
    td .btn,
    td button,
    td a.btn-small,
    td a.btn-delete {
        font-size: 11px;
        padding: 5px 10px;
        margin: 2px;
        display: inline-block;
    }

    .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }

    .btn-group .btn,
    .btn-group button {
        flex: 1;
        min-width: 60px;
    }

    /* Modal responsive */
    .modal-content,
    #edit-form > div {
        padding: 20px;
        width: calc(100% - 30px);
        max-width: 100%;
        margin: 15px;
    }
    
    #edit-form,
    .modal-overlay {
        padding: 15px;
    }
    
    /* Login page */
    .login-card {
        padding: 30px 20px;
    }
    
    .login-header h1 {
        font-size: 24px;
    }
}

/* Small Mobile - 480px */
@media (max-width: 480px) {
    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
        top: 15px;
        left: 15px;
        font-size: 18px;
    }
    
    .topbar {
        padding: 12px 15px 12px 65px;
    }
    
    .topbar h1 {
        font-size: 16px;
    }
    
    .topbar .user-info span {
        display: none;
    }
    
    .topbar .user-info i {
        margin-right: 0;
    }
    
    .content {
        padding: 12px;
    }
    
    .box {
        padding: 12px;
    }
    
    h2 {
        font-size: 18px;
    }
    
    h3 {
        font-size: 15px;
    }
    
    .btn,
    button[type="submit"] {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .btn-small,
    .btn-sm {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    table {
        font-size: 11px;
    }
    
    th, td {
        padding: 8px 6px;
    }
    
    .badge {
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .login-card {
        padding: 25px 15px;
    }
}

/* ========== PRINT STYLES ========== */

@media print {
    .sidebar,
    .topbar,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
}
