:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #ec4899;
    --accent: #8b5cf6;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --success: #10b981;
    --danger: #ef4444;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-dark);
    color: var(--text-light);
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
    /* Prevent horizontal scrolling system-wide */
    width: 100%;
}

/* Glassmorphism Utilities */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Navbar */
/* Login Styles */
.login-container {
    max-width: 400px;
    margin: 10vh auto;
    padding: 2.5rem;
    border-radius: 1.5rem;
    animation: fadeIn 0.5s ease-out;
}

.login-header h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Navbar Responsive */
.navbar {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0 2rem;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .brand {
    font-size: 1.4rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #818cf8, #c084fc, #f472b6);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.navbar .menu {
    display: flex;
    flex-direction: row;
    gap: 0.3rem;
    list-style: none;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

.navbar .menu a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.6rem 1rem;
    border-radius: 0.75rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
}

.navbar .menu a i {
    margin-right: 8px;
    font-style: normal;
}

.navbar .menu a:hover,
.navbar .menu a.active {
    color: #ffffff;
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.navbar .menu a.active {
    background: rgba(255, 255, 255, 0.15);
}

.hamburger {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

/* Container */
.container {
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease-out;
}

@media (max-width: 768px) {
    .container {
        padding: 0.75rem;
    }

    .hamburger {
        display: block;
        z-index: 1100;
    }

    .navbar .menu {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(15, 23, 42, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 0.4rem !important;
        /* Extremely tight gap */
        z-index: 1050;
        margin: 0;
        padding: 1rem !important;
        animation: fadeIn 0.3s ease;
    }

    .navbar .menu.open {
        display: flex;
    }

    .navbar .menu li {
        width: 100%;
        max-width: 250px;
        text-align: center;
        margin-bottom: 0 !important;
    }

    .navbar .menu a {
        font-size: 1rem !important;
        /* Smaller text */
        width: 100% !important;
        padding: 0.6rem 1rem !important;
        /* Compact padding */
        background: rgba(255, 255, 255, 0.05);
        /* Added slight background for visibility */
        opacity: 1 !important;
        border-radius: 0.5rem;
    }

    .navbar .menu a i {
        display: none !important;
    }

    .navbar .menu a:hover,
    .navbar .menu a.active {
        background: rgba(255, 255, 255, 0.1);
        transform: scale(1.05);
    }
}

/* Utilities */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .page-header .btn {
        width: 100%;
    }
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    /* Key for responsiveness */
    gap: 1rem;
    align-items: flex-end;
    padding: 1.5rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    width: 100%;
    /* Ensure it fits container */
}

.filter-row>.form-group {
    flex: 1;
    min-width: 150px;
    /* Reduced to fit better */
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
    }

    .filter-row>.btn,
    .filter-row>a.btn {
        width: 100%;
        /* Full width buttons on mobile */
    }
}

/* Responsive Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 1rem;
    margin-top: 2rem;
    border: 1px solid var(--glass-border);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-card);
    color: var(--text-light);
    margin: 0;
    /* Remove margin as wrapper handles it */
    min-width: 600px;
    /* Ensure table doesn't squash too much */
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
    /* Prevent wrapping in cells */
}

th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--text-muted);
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #b91c1c);
    color: white;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: block;
    font-size: 0.9rem;
}

* {
    box-sizing: border-box;
    /* Crucial for responsiveness */
}

input,
select,
textarea {
    width: 100%;
    max-width: 100%;
    /* Prevent overflow */
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    color: white;
    font-family: inherit;
    transition: border-color 0.3s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 1rem;
    color: white;
}

.card h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card p {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(to right, white, #cbd5e1);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Utiles */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    margin-bottom: 1rem;
}

h1,
h2,
h3 {
    color: var(--text-light);
    font-weight: 700;
    letter-spacing: -0.025em;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--accent);
}

/* POS Specific Styles */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
    height: calc(100vh - 140px);
    /* Increased available height */
    /* Increased offset to account for footer/padding */
    max-height: 100vh;
}

@media (max-width: 1024px) {
    .pos-layout {
        grid-template-columns: 1fr;
        height: auto;
        gap: 1rem;
    }

    .pos-cart-panel {
        position: relative;
        top: 0;
        height: auto;
        max-height: none;
        /* Permitir altura completa en móvil */
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }

    .hamburger {
        display: block;
        z-index: 1100;
        /* Above overlay */
    }

    .navbar .menu {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        z-index: 1050;
        margin: 0;
        padding: 2rem;
        animation: fadeIn 0.3s ease;
    }

    .navbar .menu.open {
        display: flex;
    }

    .navbar .menu a {
        font-size: 1.5rem;
        width: auto;
        padding: 1rem 2rem;
        background: none;
        opacity: 0.9;
    }

    .navbar .menu a:hover,
    .navbar .menu a.active {
        background: rgba(255, 255, 255, 0.1);
        transform: scale(1.05);
    }

    .pos-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.5rem;
    }

    .pos-product-card {
        min-height: 140px;
        padding: 0.75rem;
    }

    .container {
        padding: 1rem;
    }
}

.pos-products-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
    overflow: hidden;
}

.pos-search-bar input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.pos-search-bar input:focus {
    background: rgba(30, 41, 59, 0.9);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.2);
}

.pos-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom Scrollbar */
.pos-products-grid::-webkit-scrollbar {
    width: 8px;
}

.pos-products-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.pos-products-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.pos-product-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: auto;
    min-height: 150px;
    /* Increased from 120px */
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.pos-product-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.pos-product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity 0.2s;
}

.pos-product-card:hover::before {
    opacity: 1;
}

.pos-product-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.pos-product-meta {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-top: auto;
}

.pos-product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--success);
}

.pos-product-stock {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.pos-cart-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: sticky;
    top: 1rem;
}

.pos-cart-header {
    padding: 1rem;
    /* Reduced from 1.5rem */
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    /* Prevent shrinking */
}

.pos-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    min-height: 150px;
    /* Ensure minimum space */
}

/* ... */

.pos-cart-footer {
    padding: 1rem;
    /* Reduced from 1.5rem */
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
    /* Prevent shrinking */
}

.pos-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: var(--text-muted);
}

.pos-grand-total {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    font-weight: 800;
    color: white;
}

.pos-btn-checkout {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    background: linear-gradient(135deg, var(--success), #059669);
    border: none;
    border-radius: 1rem;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.4);
}

.pos-btn-checkout:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.5);
}

.pos-btn-checkout:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(1);
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    margin-top: auto;
    width: 100%;
}

/* POS Payment Selector */
.pos-payment-selector {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.pos-payment-option {
    flex: 1;
    position: relative;
}

.pos-payment-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.pos-payment-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.pos-payment-option input:checked+.pos-payment-label {
    background: rgba(79, 70, 229, 0.2);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
    color: white;
}

.pos-payment-option input:hover+.pos-payment-label {
    background: rgba(255, 255, 255, 0.05);
}

/* POS Inputs */
.pos-qty-input {
    width: 60px !important;
    padding: 0.4rem !important;
    text-align: center;
    background: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 0.5rem !important;
    color: white;
    font-weight: 600;
}

.pos-qty-input:focus {
    border-color: var(--primary) !important;
}

.pos-discount-input {
    width: 100px !important;
    padding: 0.4rem !important;
    text-align: right;
    background: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 0.5rem !important;
    color: white;
    font-weight: 600;
}

.pos-icon-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    transition: all 0.2s;
}

.pos-icon-btn:hover {
    background: rgba(239, 68, 68, 0.4);
    color: white;
    transform: scale(1.1);
}

.pos-file-input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px dashed var(--glass-border);
    border-radius: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}