:root {
    /* Color Palette - Blue Tech Minimalist */
    --primary-green: #00a8ff;
    /* Azure Blue - Principal */
    --secondary-green: #0097e6;
    /* Electron Blue - Hover/Action */
    --light-green: #e1f5fe;
    /* Light Blue - Fondos suaves */

    --tech-dark: #2f3640;
    /* Dark Blue Grey - Textos/Fondos oscuros */
    --pure-white: #ffffff;
    --gray-light: #f5f6fa;
    /* Background casi blanco */

    --text-main: #2d3436;
    --text-muted: #636e72;

    /* Variables de Diseño */
    --border-radius: 12px;
    --shadow-soft: 0 10px 30px rgba(0, 168, 255, 0.15);
    /* Sombra azulada */
    --shadow-hover: 0 15px 40px rgba(0, 168, 255, 0.25);
    --font-main: 'Inter', 'Segoe UI', sans-serif;

    /* Alertas */
    --alert-red-bg: #ffebee;
    --alert-red-text: #c62828;
    --alert-orange-bg: #fff3e0;
    --alert-orange-text: #ef6c00;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--gray-light);
    color: var(--text-main);
}

body.login-body {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

body.dashboard-body {
    display: block;
    height: auto;
    min-height: 100vh;
    background-color: var(--gray-light);
}

/* Navbar */
.navbar {
    background: var(--pure-white);
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary-green);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    margin-left: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav-links a.active {
    color: var(--primary-green);
}

.nav-links a:hover {
    color: var(--secondary-green);
}

.user-info {
    font-size: 0.9rem;
    color: var(--text-main);
}

/* Components */
.main-content {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.action-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Sticky for Inventory/Main Pages */
.main-content .action-bar {
    position: sticky;
    top: 70px;
    /* Adjust for Navbar */
    z-index: 95;
    background: #f0f2f5;
    /* Match body bg to hide scrolling items */
    padding: 10px 0;
    margin-top: -10px;
    /* Compensate padding */
}

/* Sticky Header for POS (Buttons + Search) */
.pos-sticky-header {
    position: sticky;
    top: 0;
    z-index: 95;
    background: #f4f6f8;
    /* Match pos-market bg */
    /* Pull out to cover padding of pos-market */
    margin: -1.5rem -1.5rem 1rem -1.5rem;
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
    /* transition: box-shadow 0.3s; */
}

/* When scrolling, we might want a shadow? For now optional */

/* Reset sticky on internal action bar since wrapper handles it */
.pos-market .action-bar {
    position: static !important;
    margin: 0 !important;
    /* Padding handles by inline or base, but we need to ensure it looks right */
    background: white;
    border-radius: 12px;
}

.search-box {
    position: relative;
    flex-grow: 1;
    max-width: 500px;
}

.search-box input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: none;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    box-shadow: 0 6px 20px rgba(0, 200, 83, 0.2);
}

.search-box i {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.btn-primary {
    background: var(--primary-green);
    color: white;
    border: none;
    padding: 0 1.5rem;
    height: 50px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 200, 83, 0.3);
    transition: transform 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: var(--secondary-green);
}

/* Product Grid (Inventory - Original Size) */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* POS Grid (Compact) */
.pos-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.product-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    /* Default for Inventory */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Modifier for compact cards in POS */
.pos-product-grid .product-card {
    padding: 0.8rem !important;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

/* LOW STOCK STYLES (Moved from JS inline) */
.low-stock-card {
    background-color: #ffebee;
    border: 2px solid #ef9a9a !important;
}

.low-stock-list-item {
    background-color: #ffebee;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
}

.product-code {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
}

.product-price {
    font-size: 1rem;
    /* Smaller Price */
    font-weight: 800;
    color: var(--text-main);
}

.product-name {
    font-size: 0.9rem;
    /* Smaller Name */
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text-main);
    line-height: 1.2;
}

.product-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.stock-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.stock-ok {
    background: var(--light-green);
    color: var(--secondary-green);
}

.stock-low {
    background: var(--alert-red-bg);
    color: var(--alert-red-text);
}

/* Login Elements */
.login-container {
    background: var(--pure-white);
    padding: 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    width: 100%;
    max-width: 400px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-green), var(--secondary-green));
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-main);
    transition: all 0.3s ease;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 4px var(--light-green);
}

.btn-login {
    width: 100%;
    padding: 1rem;
    background: var(--primary-green);
    color: var(--pure-white);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-login:hover {
    background: var(--secondary-green);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.error-msg {
    color: #e74c3c;
    background: #fdedec;
    padding: 0.8rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    border-left: 4px solid #e74c3c;
    display: none;
}

.logo-icon {
    font-size: 3rem;
    color: var(--primary-green);
    margin-bottom: 1rem;
    display: inline-block;
}

/* --- Modal Styles Enhanced --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
    overflow: hidden;
    border: 1px solid rgba(0, 200, 83, 0.1);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-green), var(--secondary-green));
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: white;
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.close-modal {
    color: white;
    opacity: 0.8;
    background: none;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    transition: opacity 0.2s;
}

.close-modal:hover {
    opacity: 1;
}

.modal-body {
    padding: 2rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.full-width {
    width: 100%;
}

/* --- POS Layout --- */
.pos-container {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 0;
    height: calc(100vh - 70px);
    overflow: hidden;
}

.pos-market {
    padding: 1.5rem;
    overflow-y: auto;
    background: #f4f6f8;
    border-right: 1px solid #e0e0e0;
}

.pos-cart {
    background: white;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.03);
}

.cart-header {
    padding: 1.5rem;
    background: var(--pure-white);
    border-bottom: 2px solid var(--light-green);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-items {
    flex: 1 1 0;
    min-height: 0;
    padding: 1rem;
    overflow-y: auto;
}

.cart-footer {
    padding: 1.5rem;
    background: #fdfdfd;
    border-top: 1px solid #eee;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #fff;
    margin-bottom: 0.8rem;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
    transition: all 0.2s;
}

.cart-item:hover {
    border-color: var(--primary-green);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f5f5f5;
    border-radius: 20px;
    padding: 2px 10px;
}

.qty-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-weight: 700;
    cursor: pointer;
    font-size: 1.1rem;
}

.total-display {
    display: flex;
    justify-content: space-between;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 1rem;
}

.btn-checkout {
    width: 100%;
    padding: 1.2rem;
    background: var(--tech-dark);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.btn-checkout:hover {
    background: #000;
    transform: translateY(-2px);
}

/* --- List View Styles --- */
.product-list-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.product-list-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    border: 1px solid transparent;
    transition: all 0.2s;
}

.product-list-card:hover {
    border-color: var(--primary-green);
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.list-img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    background: #f0f0f0;
    flex-shrink: 0;
}

.list-info {
    flex-grow: 1;
}

.list-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.list-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 15px;
}

.list-price {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--primary-green);
    min-width: 100px;
    text-align: right;
}

.list-actions {
    display: flex;
    gap: 10px;
}

.view-toggles {
    display: flex;
    gap: 5px;
    background: white;
    padding: 5px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-left: 10px;
}

.view-btn {
    border: none;
    background: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.view-btn.active {
    background: var(--light-green);
    color: var(--primary-green);
}

/* REPORTS SPECIFIC STYLES (Moved from reports_view.php) */
.report-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Use variables for background/color to support theming automatically */
.report-card {
    background: var(--pure-white);
    /* Was white */
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    text-align: center;
    color: var(--text-main);
}

.report-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-green);
    margin: 0.5rem 0;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--pure-white);
    /* Was white */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

.report-table th,
.report-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.report-table th {
    background: #f9f9f9;
    /* This might need override in dark mode or use var */
    font-weight: 700;
    color: var(--text-main);
}

/* In Dark Mode, th background is overridden in themes.css to #1a1a1a */

.report-table tr:last-child td {
    border-bottom: none;
}