@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-navy: #0f172a;
    --primary-navy-hover: #1e293b;
    --accent-gold: #c4a47c;
    --accent-gold-hover: #b3936a;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --bg-light: #f8fafc;
    --white: #ffffff;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --glass: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --sidebar-width: 260px;
    --sidebar-collapsed: 76px;
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-sans: 'Inter', sans-serif;
    --font-display: 'Outfit', sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
.logo-text {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
}

a {
    color: inherit;
    text-decoration: none;
}

/* =========================================
   UTILITIES
   ========================================= */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* =========================================
   LOGIN
   ========================================= */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-navy) 0%, #1e293b 50%, #0f172a 100%);
    position: relative;
    overflow: hidden;
    padding: 2rem;
}

.login-container::before,
.login-container::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 55vh;
    height: 55vh;
    background-image: url('../assets/Logo.jpeg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.06;
    pointer-events: none;
    transform: translateY(-50%);
    filter: blur(24px);
    z-index: 0;
}

.login-container::before {
    left: 8%;
}

.login-container::after {
    right: 8%;
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 3rem 2.5rem;
    text-align: center;
    background: var(--white);
    border-radius: 32px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    z-index: 10;
    position: relative;
}

.login-card img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
}

.login-card h3 {
    font-size: 1.5rem;
    color: var(--primary-navy);
    margin-bottom: 0.5rem;
}

.login-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 4px rgba(196, 164, 124, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-gold) 0%, #b3936a 100%);
    color: var(--white);
    width: 100%;
    box-shadow: 0 4px 12px rgba(196, 164, 124, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #b3936a 0%, var(--accent-gold) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(196, 164, 124, 0.45);
}

.btn-secondary {
    background: var(--white);
    color: var(--text-dark);
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--accent-gold);
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background: rgba(196, 164, 124, 0.1);
    transform: scale(1.05);
}

/* =========================================
   APP LAYOUT
   ========================================= */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--white);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    color: var(--text-dark);
    cursor: pointer;
    transition: var(--transition);
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.sidebar-toggle:hover {
    background: #f8fafc;
    border-color: var(--accent-gold);
    color: var(--primary-navy);
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary-navy);
    color: var(--white);
    padding: 1.5rem 1rem;
    position: fixed;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem;
}

.sidebar-brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--white);
    white-space: nowrap;
    opacity: 1;
    transition: var(--transition);
}

.sidebar.collapsed .sidebar-brand {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.35rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1.05rem;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(196, 164, 124, 0.15) 0%, rgba(196, 164, 124, 0.05) 100%);
    color: var(--white);
    border-left: 3px solid var(--accent-gold);
}

.nav-link:not(.active):hover {
    background: rgba(255, 255, 255, 0.06);
}

.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-link p {
    display: none;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.85rem 0;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 1.5rem 0.75rem;
}

.nav-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
    padding: 0 1rem;
    margin-bottom: 0.75rem;
    display: block;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2rem;
    width: calc(100% - var(--sidebar-width));
    transition: var(--transition);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}

.content-header h2 {
    font-size: 1.5rem;
    color: var(--primary-navy);
    margin: 0;
}

.content-header h2 i {
    color: var(--accent-gold);
    margin-right: 0.75rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-welcome {
    display: flex;
    flex-direction: column;
}

.user-welcome span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.user-welcome strong {
    font-size: 0.95rem;
    color: var(--text-dark);
}

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.role-badge.super_admin {
    background: rgba(212, 175, 55, 0.15);
    color: #d4af37;
    border: 1px solid rgba(212, 175, 55, 0.35);
}
.role-badge.admin {
    background: rgba(56, 189, 248, 0.1);
    color: #0ea5e9;
    border: 1px solid rgba(56, 189, 248, 0.2);
}
.role-badge.vendedor {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.logout-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.logout-pill:hover {
    background: var(--danger);
    color: var(--white);
    border-color: var(--danger);
    transform: scale(1.05);
}

/* =========================================
   STATS CARDS
   ========================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: var(--white);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(196, 164, 124, 0.3);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.stat-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.stat-info h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin: 0.25rem 0 0 0;
    font-weight: 700;
}

.stat-card .stat-icon {
    color: var(--accent-gold);
    background: rgba(196, 164, 124, 0.1);
}

.stat-card.success .stat-icon {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.stat-card.danger .stat-icon {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.stat-card.info .stat-icon {
    color: var(--info);
    background: rgba(59, 130, 246, 0.1);
}

.stat-card.border-gold {
    border-bottom: 4px solid var(--accent-gold);
}

/* =========================================
   COMPONENTS
   ========================================= */
.glass-panel {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-control {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 4px rgba(196, 164, 124, 0.12);
}

select.form-control {
    cursor: pointer;
}

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid #e2e8f0;
    background: var(--white);
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f8fafc;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid transparent;
}

.alert.success {
    background: rgba(16, 185, 129, 0.08);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.2);
}

.alert.danger {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.45);
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 520px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.8);
    animation: slideDown 0.35s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.modal-header h3 {
    font-size: 1.2rem;
    color: var(--primary-navy);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-muted);
    padding: 0.25rem;
    line-height: 1;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Loader esqueleto */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* User Avatar */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-navy);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* =========================================
   POS / VENTAS
   ========================================= */
.pos-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.5rem;
}

.pos-search-card {
    position: relative;
}

.pos-total {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary-navy);
}

.pos-subtotal {
    font-size: 1rem;
    color: var(--text-muted);
}

.payment-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.payment-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    background: var(--white);
}

.payment-option input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-gold);
}

.payment-option.selected {
    border-color: var(--accent-gold);
    background: rgba(196, 164, 124, 0.05);
}

.payment-option label {
    margin: 0;
    cursor: pointer;
    flex: 1;
    font-size: 0.9rem;
}

.installment-preview {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    text-align: center;
}

.cart-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #cbd5e1;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar-toggle {
        display: flex;
    }
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1.5rem;
    }
    .pos-grid {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .user-info {
        width: 100%;
        justify-content: space-between;
    }
    .modal {
        padding: 1rem;
    }
    .modal-content {
        max-width: 100%;
    }
}
