/* ============================================================
   Hotel Inventory System — Main CSS
   Stack: Vanilla CSS (no framework)
   ============================================================ */

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
    --color-primary:    #1e3a5f;
    --color-primary-d:  #152b47;
    --color-secondary:  #2d6a9f;
    --color-accent:     #e6a817;
    --color-success:    #28a745;
    --color-warning:    #ffc107;
    --color-danger:     #dc3545;
    --color-info:       #17a2b8;
    --color-bg:         #f4f6f9;
    --color-surface:    #ffffff;
    --color-border:     #dee2e6;
    --color-text:       #333333;
    --color-muted:      #6c757d;
    --sidebar-width:    260px;
    --topbar-height:    60px;
    --border-radius:    8px;
    --shadow-sm:        0 1px 3px rgba(0,0,0,.08);
    --shadow-md:        0 4px 12px rgba(0,0,0,.12);
    --transition:       0.2s ease;
    --font-sans:        'Segoe UI', 'Prompt', sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font-sans); background: var(--color-bg); color: var(--color-text); line-height: 1.6; }
a { color: var(--color-secondary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { cursor: pointer; }

/* ── Layout ─────────────────────────────────────────────────── */
.layout-wrapper { display: flex; min-height: 100vh; }
.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; margin-left: var(--sidebar-width); }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform var(--transition);
}
.sidebar-header { padding: 1.2rem 1rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-brand { display: flex; align-items: center; gap: .6rem; font-size: 1rem; font-weight: 700; }
.brand-icon { width: 20px; height: 20px; flex-shrink: 0; }
.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-hotel { display: flex; align-items: center; gap: .4rem; margin-top: .5rem; font-size: .78rem; color: rgba(255,255,255,.7); }
.hotel-icon { width: 14px; height: 14px; }

.sidebar-nav { flex: 1; padding: .5rem 0; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: .7rem;
    padding: .65rem 1rem;
    color: rgba(255,255,255,.8);
    font-size: .875rem;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--color-accent); color: #fff; font-weight: 600; }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-footer { padding: .8rem 1rem; border-top: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; }
.user-info { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--color-accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .9rem; flex-shrink: 0;
}
.user-details { min-width: 0; }
.user-name { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .7rem; color: rgba(255,255,255,.6); }
.logout-btn { color: rgba(255,255,255,.6); padding: .3rem; display: flex; align-items: center; }
.logout-btn:hover { color: #fff; text-decoration: none; }
.logout-btn svg { width: 18px; height: 18px; }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    background: var(--color-primary-d);
    color: #fff;
    display: flex; align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky; top: 0; z-index: 900;
    box-shadow: var(--shadow-sm);
}
.sidebar-toggle { background: none; border: none; color: #fff; display: none; padding: .3rem; }
.sidebar-toggle svg { width: 22px; height: 22px; }
.topbar-title { font-size: 1rem; font-weight: 600; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: .8rem; }
.topbar-time { font-size: .8rem; color: rgba(255,255,255,.7); font-variant-numeric: tabular-nums; }

/* ── Page Content ─────────────────────────────────────────────── */
.page-content { padding: 1.5rem; flex: 1; }
.page-header { margin-bottom: 1.5rem; }
.page-header h2 { font-size: 1.3rem; font-weight: 700; }
.page-header p { color: var(--color-muted); margin-top: .2rem; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--color-border);
}
.card-header {
    padding: .85rem 1.25rem;
    font-weight: 600;
    background: #f8f9fa;
    border-bottom: 1px solid var(--color-border);
    display: flex; align-items: center; gap: .5rem;
}
.card-header-danger { background: #fff5f5; border-bottom-color: #ffcccc; }
.card-body { padding: 1.25rem; }
.card-body.p-0 { padding: 0; }

/* ── Stats Grid ─────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat-card {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    display: flex; align-items: center; gap: 1rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid transparent;
}
.stat-blue  { border-left-color: var(--color-secondary); }
.stat-green { border-left-color: var(--color-success); }
.stat-red   { border-left-color: var(--color-danger); }
.stat-gold  { border-left-color: var(--color-accent); }
.stat-icon  { font-size: 2rem; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: .78rem; color: var(--color-muted); margin-top: .2rem; }

/* ── Tables ─────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th, .table td { padding: .65rem 1rem; text-align: left; border-bottom: 1px solid var(--color-border); }
.table th { font-weight: 600; background: #f8f9fa; white-space: nowrap; }
.table tbody tr:hover { background: #f0f4ff; }
.table-sm th, .table-sm td { padding: .45rem .75rem; }
.table-responsive { overflow-x: auto; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .875rem; }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: .55rem .85rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: .9rem;
    font-family: inherit;
    background: var(--color-surface);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(45,106,159,.15);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.form-actions { display: flex; gap: .75rem; align-items: center; margin-top: 1.5rem; }
.form-hint { font-size: .78rem; color: var(--color-muted); margin-top: .25rem; }
.form-error { font-size: .78rem; color: var(--color-danger); margin-top: .25rem; }

/* ── Input with icon ─────────────────────────────────────────── */
.input-icon-wrap { position: relative; }
.input-icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); font-size: .9rem; pointer-events: none; }
.input-icon-wrap .form-input { padding-left: 2.25rem; }
.toggle-password { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: .9rem; padding: 0; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .5rem 1.1rem; font-size: .875rem;
    border: 1px solid transparent; border-radius: 6px;
    font-weight: 600; cursor: pointer; font-family: inherit;
    transition: background var(--transition), transform .1s;
    white-space: nowrap; text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 15px; height: 15px; }
.btn-primary   { background: var(--color-primary);   color: #fff; }
.btn-primary:hover { background: var(--color-primary-d); text-decoration: none; color: #fff; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-secondary:hover { background: #5a6268; color: #fff; text-decoration: none; }
.btn-success   { background: var(--color-success);   color: #fff; }
.btn-success:hover { background: #218838; color: #fff; text-decoration: none; }
.btn-danger    { background: var(--color-danger);    color: #fff; }
.btn-danger:hover { background: #c82333; color: #fff; text-decoration: none; }
.btn-warning   { background: var(--color-warning);   color: #333; }
.btn-outline   { background: transparent; border-color: var(--color-primary); color: var(--color-primary); }
.btn-outline:hover { background: var(--color-primary); color: #fff; text-decoration: none; }
.btn-outline-light { background: transparent; border-color: rgba(255,255,255,.5); color: #fff; font-size: .78rem; padding: .3rem .7rem; }
.btn-sm  { padding: .35rem .75rem; font-size: .8rem; }
.btn-xs  { padding: .2rem .55rem; font-size: .75rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Alerts ─────────────────────────────────────────────────── */
.flash-container { padding: .75rem 1.5rem 0; }
.alert {
    padding: .75rem 1rem;
    border-radius: 6px;
    margin-bottom: .5rem;
    display: flex; align-items: flex-start; gap: .5rem;
    font-size: .875rem;
}
.alert-success  { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error, .alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning  { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info     { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.alert-dismissible { position: relative; padding-right: 2rem; }
.alert-close { position: absolute; right: .5rem; top: .5rem; background: none; border: none; font-size: 1.1rem; line-height: 1; opacity: .6; cursor: pointer; }
.alert-close:hover { opacity: 1; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
    display: inline-block; padding: .2rem .5rem;
    font-size: .72rem; font-weight: 700;
    border-radius: 20px; white-space: nowrap; text-transform: uppercase;
}
.badge-success   { background: #d4edda; color: #155724; }
.badge-danger    { background: #f8d7da; color: #721c24; }
.badge-warning   { background: #fff3cd; color: #856404; }
.badge-info      { background: #d1ecf1; color: #0c5460; }
.badge-secondary { background: #e2e3e5; color: #383d41; }

/* ── Grid Utilities ─────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

/* ── Spacing ─────────────────────────────────────────────────── */
.mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.ms-2 { margin-left: .5rem; }
.ml-2 { margin-left: .5rem; }
.p-0  { padding: 0; }
.fw-bold { font-weight: 700; }
.text-muted   { color: var(--color-muted); }
.text-danger  { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-warning { color: darken(var(--color-warning), 15%); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.d-flex  { display: flex; }
.d-block { display: block; }
.align-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; }
.gap-4 { gap: 1rem; }

/* ── Quick Actions ─────────────────────────────────────────── */
.quick-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.quick-btn {
    display: flex; flex-direction: column; align-items: center; gap: .4rem;
    padding: 1rem 1.5rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    color: var(--color-text); text-decoration: none;
    font-size: .8rem; font-weight: 600;
    transition: background var(--transition), box-shadow var(--transition);
    min-width: 90px;
}
.quick-btn:hover { background: #e8f0fc; border-color: var(--color-secondary); box-shadow: var(--shadow-sm); text-decoration: none; color: var(--color-primary); }
.quick-icon { font-size: 1.5rem; }

/* ── Activity List ─────────────────────────────────────────── */
.activity-list { list-style: none; }
.activity-item { padding: .6rem 1.25rem; border-bottom: 1px solid var(--color-border); }
.activity-item:last-child { border-bottom: none; }
.activity-label { font-size: .875rem; font-weight: 600; }
.activity-meta  { font-size: .75rem; color: var(--color-muted); }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 2rem; color: var(--color-muted); font-size: .9rem; }

/* ── Progress Bar ─────────────────────────────────────────────── */
.progress-bar-wrap { background: #e9ecef; border-radius: 4px; height: 6px; width: 80px; overflow: hidden; }
.progress-bar { background: var(--color-secondary); height: 100%; border-radius: 4px; transition: width .5s; }

/* ── Login Page ─────────────────────────────────────────────── */
.login-body { background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-wrapper { width: 100%; max-width: 420px; padding: 1rem; }
.login-card { background: var(--color-surface); border-radius: 12px; box-shadow: var(--shadow-md); overflow: hidden; }
.login-brand { text-align: center; padding: 2rem 2rem 1.5rem; background: var(--color-primary); color: #fff; }
.login-brand-icon { font-size: 3rem; margin-bottom: .5rem; }
.login-brand-name { font-size: 1.3rem; font-weight: 700; margin-bottom: .25rem; }
.login-brand-sub { font-size: .8rem; color: rgba(255,255,255,.7); }
.login-form { padding: 1.5rem 2rem; }
.login-form .form-group { margin-bottom: 1.1rem; }
.login-footer { text-align: center; font-size: .72rem; color: var(--color-muted); padding: 1rem 2rem; }

/* ── Hotel Grid (selector) ──────────────────────────────────── */
.hotel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; padding: .5rem 0; }
.hotel-select-card {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    text-decoration: none; color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
    position: relative;
}
.hotel-select-card:hover { border-color: var(--color-secondary); box-shadow: var(--shadow-md); text-decoration: none; color: var(--color-primary); }
.hotel-select-central { border-color: var(--color-accent); }
.hotel-inactive { opacity: .5; pointer-events: none; }
.hotel-card-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.hotel-card-code { font-size: .75rem; font-weight: 700; color: var(--color-muted); text-transform: uppercase; }
.hotel-card-name { font-size: 1rem; font-weight: 700; margin: .3rem 0; }
.hotel-card-sub  { font-size: .78rem; color: var(--color-muted); }
.hotel-card-badge { position: absolute; top: .5rem; right: .5rem; background: var(--color-danger); color: #fff; font-size: .65rem; padding: .15rem .4rem; border-radius: 4px; }

/* ── Barcode Scanner ─────────────────────────────────────────── */
.scanner-container { max-width: 500px; margin: 0 auto; }
#qr-reader { border-radius: var(--border-radius); overflow: hidden; border: 2px solid var(--color-secondary); }
.scan-result-box {
    padding: 1rem;
    border-radius: 6px;
    margin-top: 1rem;
    font-family: monospace;
    font-size: .9rem;
    min-height: 40px;
    border: 1px solid var(--color-border);
}
.scan-ok  { background: #d4edda; border-color: #c3e6cb; color: #155724; }
.scan-err { background: #f8d7da; border-color: #f5c6cb; color: #721c24; }
.usb-input-wrap { position: relative; }
.usb-input { border: 2px dashed var(--color-secondary); font-size: 1rem; padding: .7rem 1rem; }
.usb-input:focus { border-style: solid; }

/* ── Barcode Print ─────────────────────────────────────────── */
.barcode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.barcode-item { border: 1px solid var(--color-border); border-radius: 6px; padding: .75rem; text-align: center; }
.barcode-item img { max-width: 100%; height: 60px; object-fit: contain; }
.barcode-text { font-family: monospace; font-size: .72rem; margin-top: .3rem; word-break: break-all; }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.page-link {
    padding: .4rem .75rem; border: 1px solid var(--color-border);
    border-radius: 4px; font-size: .85rem; color: var(--color-primary);
    text-decoration: none; transition: background var(--transition);
}
.page-link:hover { background: #e8f0fc; text-decoration: none; }
.page-link.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.page-link.disabled { color: var(--color-muted); pointer-events: none; }

/* ── Modals ─────────────────────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 2000;
    align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box { background: var(--color-surface); border-radius: 10px; width: 100%; max-width: 480px; box-shadow: var(--shadow-md); overflow: hidden; }
.modal-header { padding: 1rem 1.25rem; background: var(--color-primary); color: #fff; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }

.toggle-password { position: absolute; right: .75rem; background: none; border: none; cursor: pointer; font-size: 1rem; padding: 0; color: var(--color-muted); }
.toggle-password:hover { color: var(--color-primary); }
.modal-body   { padding: 1.25rem; }
.modal-footer { padding: .75rem 1.25rem; background: #f8f9fa; border-top: 1px solid var(--color-border); display: flex; justify-content: flex-end; gap: .5rem; }
.modal-close  { background: none; border: none; color: #fff; font-size: 1.2rem; cursor: pointer; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 992px) {
    :root { --sidebar-width: 0px; }
    .sidebar { transform: translateX(-260px); width: 260px; }
    .sidebar.open { transform: translateX(0); }
    .main-area { margin-left: 0; }
    .sidebar-toggle { display: flex; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 576px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-wrapper { padding: .5rem; }
    .page-content { padding: 1rem; }
    .quick-actions { gap: .4rem; }
    .quick-btn { padding: .75rem 1rem; min-width: 80px; }
}

/* ── Print Styles ─────────────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .flash-container, .btn, .pagination, .quick-actions { display: none !important; }
    .main-area { margin-left: 0; }
    .page-content { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ccc; }
    body { background: white; }
}
