/* MS Barbershop - estilos extra: acceso, usuarios, sincronizacion y diseno para telefono/tablet */

/* ---------- Pantalla de acceso ---------- */
/* Mientras no hay sesion, la app queda oculta (nada de datos a la vista ni parpadeos) */
html.need-login .app-container { visibility: hidden; }
.auth-overlay {
    position: fixed; inset: 0; z-index: 9999990; display: flex; align-items: center; justify-content: center;
    padding: 20px; font-family: 'Inter', 'Outfit', sans-serif; overflow: hidden;
    background:
        radial-gradient(900px 500px at 15% 10%, rgba(229, 169, 60, 0.18), transparent 60%),
        radial-gradient(800px 500px at 90% 95%, rgba(56, 189, 248, 0.12), transparent 60%),
        #0B1120;
}
/* Logo de la barberia como fondo */
.auth-overlay::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: url(../assets/login-logo.png) center 46% / auto 92% no-repeat;
    opacity: 0.26; filter: saturate(1.1) drop-shadow(0 0 40px rgba(229, 169, 60, 0.15));
}
.auth-overlay::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(11, 17, 32, 0) 30%, rgba(11, 17, 32, 0.78) 100%);
}
.auth-card {
    position: relative; z-index: 2; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    width: 100%; max-width: 380px; text-align: center; padding: 30px 28px 24px;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.88) 0%, rgba(22, 32, 51, 0.92) 100%);
    border: 1px solid rgba(229, 169, 60, 0.4); border-radius: 22px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
    animation: authIn .35s ease-out;
}
.auth-logo-img { height: 96px; width: auto; margin: 0 auto 10px; display: block; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .5)); }
@keyframes authIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.auth-logo { font-size: 54px; line-height: 1; margin-bottom: 6px; filter: drop-shadow(0 6px 14px rgba(229, 169, 60, .35)); }
.auth-title { font-family: 'Outfit', sans-serif; font-size: 24px; font-weight: 800; color: #E5A93C; margin: 4px 0 2px; letter-spacing: -.3px; }
.auth-sub { font-size: 13px; color: #94A3B8; margin: 0 0 22px; }
.auth-input {
    width: 100%; box-sizing: border-box; margin-bottom: 12px; padding: 13px 14px; font-size: 15px;
    color: #F8FAFC; background: #0F172A; border: 1px solid #334155; border-radius: 12px; outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.auth-input:focus { border-color: #E5A93C; box-shadow: 0 0 0 3px rgba(229, 169, 60, .18); }
.auth-btn {
    width: 100%; padding: 13px; margin-top: 4px; font-size: 15px; font-weight: 800; color: #000; cursor: pointer;
    background: linear-gradient(135deg, #F5C25B, #D97706); border: none; border-radius: 12px;
    transition: transform .12s, filter .12s;
}
.auth-btn:hover { filter: brightness(1.08); }
.auth-btn:active { transform: scale(.98); }
.auth-btn:disabled { opacity: .6; cursor: wait; }
.auth-error { min-height: 18px; margin: 12px 0 0; font-size: 12.5px; color: #F87171; font-weight: 600; }
.auth-foot { margin: 14px 0 0; font-size: 11px; color: #64748B; }

/* ---------- Usuario y estado de sincronizacion (barra superior) ---------- */
.user-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 12px; font-size: 12px; font-weight: 700;
    color: #F8FAFC; background: rgba(15, 23, 42, 0.9); border: 1px solid var(--border-color); border-radius: 20px; white-space: nowrap;
}
.user-chip-btn {
    border: none; cursor: pointer; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 16px;
    color: #CBD5E1; background: rgba(148, 163, 184, 0.15);
}
.user-chip-btn:hover { background: rgba(229, 169, 60, 0.25); color: #E5A93C; }
.cloud-status {
    font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 8px; border: 1px solid #10B981;
    cursor: pointer; white-space: nowrap; background: rgba(16, 185, 129, .15); color: #10B981;
}
.users-card { margin-bottom: 20px; }
.users-form { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 8px; padding: 12px 16px; align-items: center; }

/* ---------- Diseno para telefono y tablet ---------- */
@media (max-width: 900px) {
    html, body { overflow-x: hidden; }
    .app-container { flex-direction: column; height: 100vh; }
    @supports (height: 100dvh) { .app-container { height: 100dvh; } }

    /* El menu pasa abajo, como en una app movil */
    .sidebar {
        position: fixed; left: 0; right: 0; bottom: 0; width: 100%; height: auto; padding: 0;
        flex-direction: row; border-right: none; border-top: 1px solid var(--border-color);
        z-index: 500; background: #0D1526; padding-bottom: env(safe-area-inset-bottom);
    }
    .brand-header, .sidebar-footer { display: none; }
    .nav-menu {
        flex-direction: row; gap: 0; padding: 4px; overflow-x: auto; overflow-y: hidden;
        -webkit-overflow-scrolling: touch; scrollbar-width: none; flex: 1;
    }
    .nav-menu::-webkit-scrollbar { display: none; }
    .nav-item { flex: 0 0 auto; }
    .nav-item button {
        flex-direction: column; gap: 2px; padding: 7px 10px; min-width: 68px; font-size: 10px; line-height: 1.15;
        text-align: center; white-space: normal; justify-content: center; align-items: center; border-radius: 10px;
    }
    .nav-item button .nav-icon { font-size: 19px; margin: 0; }

    .main-content { flex: 1; min-height: 0; }
    .topbar { height: auto; padding: 8px 12px; flex-direction: column; align-items: stretch; gap: 6px; }
    .topbar-left h1 { font-size: 15px; }
    .topbar-left p { font-size: 11px; }
    .topbar-right { flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding-bottom: 3px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .topbar-right::-webkit-scrollbar { display: none; }
    .topbar-right > * { flex: 0 0 auto; }

    .view-area { padding: 12px 12px 96px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 12px; }

    .view-section [style*="grid-template-columns"], .modal-body [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
    .users-form { grid-template-columns: 1fr; }

    .pos-layout { grid-template-columns: 1fr; height: auto; gap: 14px; }
    .pos-catalog { height: 62vh; }
    .pos-cart { height: auto; }

    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .custom-table { min-width: 560px; }
    .modal-box { max-width: calc(100% - 16px); max-height: 92vh; }

    /* 16px evita que iPhone haga zoom al tocar un campo */
    input, select, textarea { font-size: 16px !important; }
    .btn { min-height: 38px; }
    .auth-card { padding: 28px 20px 22px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-info h3 { font-size: 18px; }
    .items-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); padding: 12px; }
}

/* ---- Fondo tematico del sistema (poste de barbero) ---- */
.main-content {
    background: linear-gradient(180deg, rgba(11,17,32,.78), rgba(11,17,32,.88)), url(../assets/app-bg.jpg) center / cover no-repeat fixed !important;
}
.stat-card, .table-card, .pos-catalog, .pos-cart, .ai-card {
    background: rgba(30,41,59,.74) !important;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
@media (max-width: 900px) {
    .main-content { background-attachment: scroll !important; }
}
