/* ============================================================
   Devsoft Build POS — Design System 2026
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --bg: #eef8f8;
    --surface: #ffffff;
    --text: #051a1a;
    --text-muted: #4a6b6b;
    --border: #c8e8e8;
    --primary: #00e5ff;
    --primary-dark: #00c8e0;
    --ds-dark: #051a1a;
    --ds-teal: #003333;
    --ds-cyan: #00e5ff;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.18);
    --shadow-sm: 0 4px 20px rgba(15, 23, 42, 0.08);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    background: var(--bg);
}

.app-content { background: var(--bg); }

/* ── Auth pages ─────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(255,255,255,0.15) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 90%, rgba(255,255,255,0.08) 0%, transparent 50%);
    pointer-events: none;
}

.auth-page.central-auth {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #312e81 100%);
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow);
    animation: cardIn 0.5s ease-out;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(24px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Central admin login */
.central-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.central-logo {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
}

.auth-brand {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.auth-card h2 {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.auth-sub {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.75rem;
}

/* Tenant login */
.tenant-login-card { max-width: 460px; }

.devsoft-badge {
    text-align: center;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    opacity: 0.7;
}

.store-identity {
    text-align: center;
    margin-bottom: 0.5rem;
}

.store-logo {
    width: 88px;
    height: 88px;
    object-fit: contain;
    border-radius: 20px;
    margin: 0 auto 1rem;
    display: block;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border);
    background: #fff;
    padding: 6px;
}

.store-logo-placeholder {
    width: 88px;
    height: 88px;
    border-radius: 20px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
}

.store-name {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.store-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.store-meta span:first-child {
    font-weight: 600;
    color: var(--text);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0 1.25rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.auth-footer strong { color: var(--text); }

/* ── Forms ──────────────────────────────────────────────── */
.auth-form { display: flex; flex-direction: column; gap: 1.1rem; }

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }

.form-group label,
.auth-form > label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}

.form-group input,
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"],
.auth-form input[type="number"],
.auth-form select,
.auth-form textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    font-family: var(--font);
    font-size: 0.95rem;
    color: var(--text);
    background: #f8fafc;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.form-group input:focus,
.auth-form input:focus,
.auth-form select:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.form-group input::placeholder { color: #94a3b8; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.25rem;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
    white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: linear-gradient(135deg, var(--ds-cyan) 0%, #00c8e0 100%);
    color: var(--ds-dark);
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(0, 229, 255, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(0, 229, 255, 0.5);
}

.btn-block { width: 100%; padding: 0.9rem 1.25rem; font-size: 0.95rem; }

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }

.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

/* ── App layout (POS interno) ───────────────────────────── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-header {
    color: var(--hd-text, #fff);
    padding: 0 1.5rem;
    height: 56px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.header-inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-page-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--hd-text);
    letter-spacing: -0.02em;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.84rem;
}

.header-user-name { color: var(--hd-text-muted); font-weight: 500; }

.btn-header {
    background: var(--hd-hover-bg) !important;
    color: var(--hd-text) !important;
    border: 1px solid var(--hd-border) !important;
    box-shadow: none !important;
}

.btn-header:hover { filter: brightness(0.95); }

.app-sidebar {
    width: 240px;
    flex-shrink: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

/* Logo + nombre en sidebar */
.sidebar-identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.1rem 1rem;
    border-bottom: 1px solid var(--sb-border);
    background: var(--sb-hover-bg);
}

.sidebar-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(255,255,255,0.9);
    padding: 4px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.sidebar-logo-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--sb-accent);
    color: var(--sb-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.sidebar-store-info {
    min-width: 0;
    line-height: 1.3;
}

.sidebar-store-info strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--sb-text);
    word-break: break-word;
}

.sidebar-store-info small {
    font-size: 0.72rem;
    color: var(--sb-text-muted);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.65rem 0.6rem;
}

.nav-section {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--sb-section);
    padding: 0.75rem 0.75rem 0.25rem;
    margin-top: 0.15rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.62rem 0.8rem;
    color: var(--sb-text-muted);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
    border-left: 3px solid transparent;
}

.nav-icon {
    display: flex; align-items: center; justify-content: center;
    width: 1.35rem; height: 1.35rem; flex-shrink: 0;
}
.nav-icon svg { width: 18px; height: 18px; opacity: 0.85; }
.nav-item.active .nav-icon svg { opacity: 1; stroke-width: 2.25; }

.nav-item:hover {
    background: var(--sb-hover-bg);
    color: var(--sb-text);
}

.nav-item.active {
    background: var(--sb-hover-bg);
    color: var(--sb-accent);
    border-left-color: var(--sb-accent);
    font-weight: 700;
}

.sidebar-brand {
    padding: 0.85rem 0.75rem;
    text-align: center;
    border-top: 1px solid var(--sb-border);
    margin-top: auto;
}
.sidebar-brand img { width: 26px; border-radius: 50%; opacity: 0.7; margin-bottom: 0.2rem; }
.sidebar-brand small {
    display: block;
    font-size: 0.6rem;
    color: var(--sb-section);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.app-content {
    flex: 1;
    padding: 1.5rem;
    overflow: auto;
}

/* ── Admin central panel ──────────────────────────────────── */
.admin-central { background: var(--bg); min-height: 100vh; }

.central-header {
    background: linear-gradient(135deg, #051a1a, #003333);
    color: #fff;
    border-bottom: 1px solid rgba(0, 229, 255, 0.2);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.central-header .brand {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0.7;
    display: block;
}

.central-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.central-header > div:last-child {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
}

.central-header .btn {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
}

.central-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ── Data table ─────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    font-size: 0.875rem;
}

.data-table thead {
    background: #f8fafc;
}

.data-table th {
    padding: 0.85rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover { background: #f8fafc; }

.data-table code {
    background: #f1f5f9;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #475569;
}

.data-table .actions { white-space: nowrap; }

.row-warning { background: #fffbeb !important; }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-ok     { background: #d1fae5; color: #047857; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-warning{ background: #fef3c7; color: #b45309; }
.badge-warn   { background: #fef3c7; color: #b45309; }
.badge-info   { background: #dbeafe; color: #1d4ed8; }
.badge-muted  { background: #f1f5f9; color: #64748b; }

.header-user .badge {
    background: var(--hd-badge-bg);
    color: var(--hd-text);
    font-weight: 600;
}

/* ── Mobile sidebar toggle ──────────────────────────────── */
.sidebar-toggle {
    display: none;
    align-items: center; justify-content: center;
    width: 40px; height: 40px; flex-shrink: 0;
    border: 1px solid var(--hd-border);
    background: var(--hd-hover-bg);
    border-radius: 10px; cursor: pointer;
    color: var(--hd-text);
    padding: 0;
}
.sidebar-toggle svg { width: 20px; height: 20px; }

.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(5, 26, 26, 0.55);
    z-index: 199;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

body.sidebar-open { overflow: hidden; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
    .app-content { padding: 1.15rem; }
    .central-content { padding: 1.25rem; }
}

@media (max-width: 768px) {
    html { font-size: 15px; }

    .auth-card { padding: 2rem 1.25rem; border-radius: 20px; }

    /* Header móvil */
    .app-header { padding: 0 0.85rem; height: 52px; }
    .sidebar-toggle { display: flex; }
    .header-inner { gap: 0.65rem; }
    .header-page-title {
        font-size: 0.92rem;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        flex: 1; min-width: 0;
    }
    .header-user-name { display: none; }
    .header-user .badge { display: none; }
    .header-user { gap: 0.4rem; }

    /* Sidebar off-canvas */
    .app-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: min(280px, 88vw);
        z-index: 200;
        transform: translateX(-105%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        height: 100vh;
        height: 100dvh;
        box-shadow: 4px 0 24px rgba(0,0,0,0.2);
    }
    .app-sidebar.open { transform: translateX(0); }

    .app-content {
        padding: 0.85rem;
        padding-bottom: calc(0.85rem + env(safe-area-inset-bottom));
    }

    /* Botones táctiles */
    .btn { min-height: 40px; }
    .btn-sm { min-height: 36px; padding: 0.45rem 0.75rem; }

    /* Tablas compactas (columnas reducidas vía .hide-mobile en modules.css) */
    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: 0.6rem 0.7rem; }

    /* Admin central */
    .central-header {
        padding: 0.85rem 1rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .central-header h1 { font-size: 1.05rem; }
    .central-header > div:first-child img { width: 36px; height: 36px; }
    .central-content { padding: 0.85rem; }
}

@media (max-width: 480px) {
    .header-page-title { font-size: 0.85rem; }
    .btn-header { padding: 0.35rem 0.65rem; font-size: 0.75rem; }
}

/* SweetAlert en móvil */
@media (max-width: 768px) {
    .swal2-popup {
        width: calc(100% - 2rem) !important;
        max-width: 360px;
        font-size: 0.9rem;
        padding: 1.25rem;
    }
    .swal2-title { font-size: 1.15rem !important; }
    .swal2-actions { flex-direction: column-reverse; gap: 0.5rem; width: 100%; }
    .swal2-actions button { width: 100%; min-height: 44px; }
}
