:root {
    --bg-dark: #0A0A0A;
    --bg-surface: #141414;
    --bg-card: #1C1C1C;
    --primary-gold: #F5A623;
    --text-main: #FFFFFF;
    --text-muted: #9E9E9E;
    --border-color: rgba(255, 255, 255, 0.1);
    --gold-glow: 0 0 20px rgba(245, 166, 35, 0.2);
    --font-main: 'Inter', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Utilitarios */
.hidden { display: none !important; }
.gold-text { color: var(--primary-gold); }
.gold-gradient {
    background: linear-gradient(135deg, #F5A623 0%, #F5D061 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* === LOGIN === */
#login-view {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, var(--bg-surface) 0%, var(--bg-dark) 100%);
}

.login-box {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--gold-glow);
    text-align: center;
    width: 100%;
    max-width: 400px;
}

.logo-circle {
    width: 80px; height: 80px;
    background: var(--bg-surface);
    border: 1px solid var(--primary-gold);
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    margin: 0 auto 20px;
    box-shadow: var(--gold-glow);
}
.logo-circle .material-icons { font-size: 40px; }
.subtitle { color: var(--text-muted); margin-bottom: 30px; letter-spacing: 2px; font-size: 12px; text-transform: uppercase; }

.input-group {
    display: flex; align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    transition: all 0.3s;
}
.input-group:focus-within {
    border-color: var(--primary-gold);
    box-shadow: 0 0 10px rgba(245, 166, 35, 0.1);
}
.input-group .material-icons { color: var(--text-muted); margin-right: 12px; }
.input-group input {
    background: transparent; border: none; color: white; width: 100%; outline: none; font-size: 15px;
}

.btn-primary {
    background: var(--primary-gold);
    color: var(--bg-dark);
    border: none;
    border-radius: 12px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 800;
    width: 100%;
    cursor: pointer;
    display: flex; justify-content: center; align-items: center; gap: 8px;
    transition: transform 0.2s, opacity 0.2s;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-2px); }
.btn-primary.btn-sm { padding: 8px 16px; font-size: 13px; width: auto; }

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover { background: var(--border-color); }

.error-msg { background: rgba(244, 67, 54, 0.1); border: 1px solid rgba(244, 67, 54, 0.3); color: #f44336; padding: 10px; border-radius: 8px; margin-bottom: 20px; font-size: 13px; }

/* === APP LAYOUT === */
.layout { display: flex; width: 100vw; height: 100vh; }

.sidebar {
    width: 260px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column;
}
.sidebar-header { padding: 24px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border-color); }
.brand-text { font-weight: 800; letter-spacing: 2px; }

.user-info { padding: 24px; display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; background: var(--bg-card); border-radius: 50%; display: flex; justify-content: center; align-items: center; border: 1px solid var(--primary-gold); color: var(--primary-gold); }
.user-info h3 { font-size: 14px; }
.user-info p { font-size: 12px; color: var(--text-muted); }

.nav-menu { padding: 0 16px; flex: 1; }
.nav-item {
    background: transparent; border: none; color: var(--text-muted); width: 100%; text-align: left; padding: 12px 16px; border-radius: 8px; margin-bottom: 8px; cursor: pointer; display: flex; align-items: center; gap: 12px; font-size: 14px; font-family: var(--font-main); transition: all 0.2s;
}
.nav-item:hover { background: var(--bg-card); color: white; }
.nav-item.active { background: rgba(245, 166, 35, 0.1); color: var(--primary-gold); font-weight: 600; }

.sidebar-footer { padding: 24px; border-top: 1px solid var(--border-color); margin-top: auto; flex-shrink: 0; }
.btn-logout { color: #f44336; }
.btn-logout:hover { background: rgba(244, 67, 54, 0.1); }

.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    background: var(--bg-dark);
}

header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
header h2 { font-size: 24px; font-weight: 600; }
header p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; margin-bottom: 40px; }
.stat-card {
    background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 16px; padding: 24px; display: flex; align-items: center; gap: 20px; transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-4px); border-color: rgba(245, 166, 35, 0.3); }
.stat-icon { width: 48px; height: 48px; background: rgba(245, 166, 35, 0.1); border-radius: 12px; display: flex; justify-content: center; align-items: center; color: var(--primary-gold); }
.stat-data h3 { font-size: 13px; color: var(--text-muted); font-weight: normal; }
.stat-data h2 { font-size: 28px; font-weight: 800; margin-top: 4px; }

.card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 16px; padding: 24px; }
.alert-info { background: rgba(33, 150, 243, 0.1); border-color: rgba(33, 150, 243, 0.3); color: #2196F3; display: flex; gap: 12px; align-items: center; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 16px; text-align: left; border-bottom: 1px solid var(--border-color); }
th { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
tr:last-child td { border-bottom: none; }

/* === MODALS === */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center; z-index: 1000; backdrop-filter: blur(5px); }
.modal { background: var(--bg-surface); padding: 32px; border-radius: 20px; border: 1px solid var(--border-color); width: 100%; max-width: 400px; box-shadow: 0 20px 40px rgba(0,0,0,0.5); }
.modal h3 { margin-bottom: 24px; }
.modal form input, .modal form select {
    width: 100%; background: var(--bg-dark); border: 1px solid var(--border-color); color: white; padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; outline: none; font-family: var(--font-main);
}
.modal form input:focus, .modal form select:focus { border-color: var(--primary-gold); }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }

/* === TOAST === */
.toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: var(--bg-surface); border: 1px solid var(--primary-gold); color: white; padding: 12px 24px; border-radius: 30px; font-size: 14px; box-shadow: var(--gold-glow); z-index: 2000; transition: opacity 0.3s;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #333;
  transition: .4s;
  border-radius: 34px;
}

/* ==========================================
   MOBILE RESPONSIVENESS (HAMBURGER MENU)
========================================== */

/* The topbar is hidden on desktop */
.mobile-header {
    display: none;
}

body.is-mobile .mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    z-index: 1000;
}

body.is-mobile .mobile-header h2 {
    margin: 0;
    font-size: 18px;
    letter-spacing: 2px;
}

body.is-mobile .btn-hamburger {
    background: transparent;
    border: none;
    color: var(--primary-gold);
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0;
}

/* Layout changes for mobile */
body.is-mobile #app-layout,
body.is-mobile #main-screen {
    flex-direction: column;
}

/* Sidebar becomes a sliding drawer */
body.is-mobile .sidebar {
    position: fixed !important;
    top: 0;
    left: -300px;
    width: 260px !important;
    height: 100vh !important;
    max-height: 100vh !important;
    background: var(--bg-surface);
    z-index: 2000;
    transition: left 0.3s ease;
    box-shadow: 2px 0 15px rgba(0,0,0,0.8);
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    overflow-y: auto;
    padding: 20px !important;
}

body.is-mobile .sidebar.open {
    left: 0;
}

/* Revert previous mobile hacks so sidebar items look normal inside drawer */
body.is-mobile .sidebar h2,
body.is-mobile .user-info {
    display: flex !important;
}
body.is-mobile .sidebar nav {
    flex-direction: column !important;
    overflow-x: hidden !important;
    white-space: normal !important;
}
body.is-mobile .nav-item {
    margin-bottom: 8px !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
}
body.is-mobile .sidebar > div {
    flex-direction: column !important;
    align-items: stretch !important;
    padding-top: 20px !important;
}

/* Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.6);
    z-index: 1999;
}

body.is-mobile .mobile-overlay.active {
    display: block;
}

/* General spacing on mobile */
body.is-mobile .main-content, 
body.is-mobile main {
    padding: 15px !important;
    height: auto !important;
    flex: 1;
    overflow-y: auto;
}

body.is-mobile .stats-grid,
body.is-mobile #tables-grid, 
body.is-mobile #pos-tables-grid {
    grid-template-columns: 1fr !important;
}

body.is-mobile .topbar {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

body.is-mobile .card.table-container, 
body.is-mobile .card > div[style*="overflow-x"] {
    overflow-x: auto;
}

body.is-mobile table th, 
body.is-mobile table td {
    font-size: 13px !important;
    padding: 12px 16px !important;
    white-space: nowrap !important;
}
body.is-mobile table {
    min-width: 800px !important;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #F5A623;
}
input:checked + .slider:before {
  transform: translateX(20px);
}

/* Boton Flotante WhatsApp */
.whatsapp-float {
    position: fixed;
    width: 60px;
    height: 60px;
    bottom: 40px;
    right: 40px;
    background-color: #25d366;
    color: #FFF;
    border-radius: 50px;
    text-align: center;
    font-size: 30px;
    box-shadow: 2px 2px 3px #999;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    transition: transform 0.3s ease;
}

.whatsapp-float:hover {
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .whatsapp-float {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
        padding: 8px;
    }
}
