* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f0f5;
}

/* ======================================== */
/* LOGIN - Fucsia y Dorado */
/* ======================================== */
.login-body {
    background: linear-gradient(135deg, #940035 0%, #6b0027 50%, #3d0015 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 15px;
    padding: 30px 25px;
    box-shadow: 0 10px 50px rgba(148, 0, 53, 0.3);
    text-align: center;
    border: 2px solid #D4AF37;
}

.login-box h1 {
    font-size: 22px;
    margin-bottom: 5px;
    color: #940035;
    font-weight: 700;
}

.login-box h1 span {
    color: #D4AF37;
}

.login-box .subtitle {
    font-size: 11px;
    color: #888;
    margin-bottom: 20px;
}

.login-box h2 {
    margin-bottom: 25px;
    color: #940035;
    font-size: 17px;
    font-weight: 300;
}

.login-box input {
    width: 100%;
    padding: 12px 15px;
    margin: 8px 0;
    border: 2px solid #e8e0e5;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.login-box input:focus {
    border-color: #940035;
    outline: none;
    box-shadow: 0 0 0 3px rgba(148, 0, 53, 0.15);
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #940035, #6b0027);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-box button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(148, 0, 53, 0.4);
}

/* ======================================== */
/* DASHBOARD CONTAINER - Mobile First */
/* ======================================== */
.dashboard-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ======================================== */
/* SIDEBAR - Fucsia (Mobile First) */
/* ======================================== */
.sidebar {
    width: 100%;
    background: linear-gradient(180deg, #940035 0%, #6b0027 100%);
    color: white;
    padding: 15px 12px;
    box-shadow: 0 3px 20px rgba(148, 0, 53, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar h2 {
    font-size: 18px;
    margin-bottom: 3px;
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(212, 175, 55, 0.3);
}

.sidebar h2 span {
    color: #D4AF37;
}

.sidebar .slogan {
    text-align: center;
    font-size: 9px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 12px;
    letter-spacing: 1px;
}

/* Menú en modo hamburguesa para móviles */
.sidebar nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

.sidebar nav a {
    display: inline-block;
    padding: 6px 10px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s;
    font-size: 12px;
    border-left: 2px solid transparent;
    white-space: nowrap;
}

.sidebar nav a:hover {
    background: rgba(212, 175, 55, 0.2);
    color: white;
    border-left-color: #D4AF37;
}

.sidebar nav a.active {
    background: rgba(212, 175, 55, 0.25);
    color: white;
    border-left-color: #D4AF37;
    font-weight: 600;
}

/* ======================================== */
/* MAIN CONTENT */
/* ======================================== */
.main-content {
    flex: 1;
    padding: 12px 15px;
    background: #f8f4f7;
    width: 100%;
    overflow-x: hidden;
}

/* ======================================== */
/* TOP BAR */
/* ======================================== */
.top-bar {
    background: white;
    padding: 10px 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    border: 1px solid #f0e8ed;
    flex-wrap: wrap;
    gap: 8px;
}

.user-info {
    font-weight: 600;
    color: #940035;
    font-size: 13px;
}

.user-info .rango {
    color: #D4AF37;
    font-weight: 400;
    font-size: 11px;
}

.logout-btn {
    background: #940035;
    color: white;
    padding: 6px 14px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 12px;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: #6b0027;
}

/* ======================================== */
/* CARDS */
/* ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 15px 12px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    border-top: 3px solid #D4AF37;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card h3 {
    font-size: 11px;
    color: #888;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-card .value {
    font-size: 20px;
    font-weight: 700;
    color: #940035;
}

.stat-card small {
    font-size: 10px;
    color: #aaa;
    display: block;
    margin-top: 3px;
}

/* ======================================== */
/* TABLAS - Scroll horizontal en móviles */
/* ======================================== */
.data-table {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    border: 1px solid #f0e8ed;
    width: 100%;
}

.data-table .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 5px 0;
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.data-table th,
.data-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #f0e8ed;
    font-size: 12px;
}

.data-table th {
    background: #940035;
    color: white;
    font-weight: 600;
    font-size: 11px;
    white-space: nowrap;
}

.data-table tr:hover {
    background: #fdf8fa;
}

.data-table .table-title {
    padding: 12px 15px;
    color: #940035;
    font-size: 14px;
    font-weight: 600;
}

/* ======================================== */
/* FORMULARIOS - Mobile First */
/* ======================================== */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: #4a2a3a;
    font-size: 12px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e8e0e5;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #940035;
    outline: none;
    box-shadow: 0 0 0 3px rgba(148, 0, 53, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

/* ======================================== */
/* BOTONES */
/* ======================================== */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-block;
    text-decoration: none;
    text-align: center;
    min-height: 40px;
    min-width: 44px;
}

.btn-primary {
    background: linear-gradient(135deg, #940035, #6b0027);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(148, 0, 53, 0.3);
}

.btn-danger {
    background: #c0392b;
    color: white;
}

.btn-danger:hover {
    background: #a93226;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #d68910;
}

.btn-gold {
    background: linear-gradient(135deg, #D4AF37, #b8942e);
    color: #3d0015;
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.4);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
    min-height: 30px;
    min-width: 30px;
}

/* ======================================== */
/* ALERTAS */
/* ======================================== */
.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 500;
    font-size: 13px;
}

.alert.error {
    background: #fdf0f0;
    color: #940035;
    border: 1px solid #f5d0d0;
}

.alert.success {
    background: #f0f7f0;
    color: #1a7a3a;
    border: 1px solid #d0e8d0;
}

/* ======================================== */
/* PUNTO DE VENTA - Mobile First */
/* ======================================== */
.ventas-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.productos-lista {
    background: white;
    border-radius: 10px;
    padding: 12px;
    border: 1px solid #f0e8ed;
    order: 2;
}

.carrito {
    background: white;
    border-radius: 10px;
    padding: 12px;
    border: 1px solid #f0e8ed;
    order: 1;
}

.productos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.producto-btn {
    padding: 8px 6px;
    background: linear-gradient(135deg, #fdf8fa, #f5eef2);
    border: 2px solid #f0e8ed;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.3s;
    color: #4a2a3a;
    text-align: center;
}

.producto-btn:hover {
    background: linear-gradient(135deg, #940035, #6b0027);
    color: white;
    transform: scale(1.02);
    border-color: #940035;
}

.producto-btn .precio {
    display: block;
    color: #940035;
    font-weight: 700;
    font-size: 12px;
    margin-top: 2px;
}

.producto-btn:hover .precio {
    color: #D4AF37;
}

.buscador {
    margin-bottom: 10px;
    position: relative;
}

.buscador input {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 2px solid #e8e0e5;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.buscador input:focus {
    border-color: #940035;
    outline: none;
}

/* ======================================== */
/* AUTOCOMPLETE */
/* ======================================== */
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e8e0e5;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.autocomplete-item {
    padding: 6px 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0e8ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.autocomplete-item:hover {
    background: #fdf8fa;
}

.autocomplete-item .nombre {
    flex: 1;
}

.autocomplete-item .precio {
    font-weight: bold;
    color: #940035;
    margin-left: 8px;
}

.autocomplete-item .stock {
    font-size: 9px;
    color: #888;
    margin-left: 8px;
}

.autocomplete-item.sin-stock {
    opacity: 0.5;
    background: #fdf0f0;
}

/* ======================================== */
/* TABLA CARRITO */
/* ======================================== */
.tabla-carrito {
    width: 100%;
    font-size: 11px;
}

.tabla-carrito th,
.tabla-carrito td {
    padding: 4px 3px;
    text-align: left;
}

.tabla-carrito th {
    background: #940035;
    color: white;
    padding: 5px 6px;
    font-size: 10px;
}

.cantidad-input {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    padding: 2px 0;
    text-align: center;
    font-size: 11px;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.btn-eliminar {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 2px 5px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 9px;
}

.carrito-total {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 2px solid #D4AF37;
    font-size: 15px;
    font-weight: bold;
    color: #940035;
}

.metodo-pago {
    display: flex;
    gap: 8px;
    margin: 8px 0;
}

.metodo-opcion {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    flex: 1;
    justify-content: center;
    font-weight: 600;
    font-size: 11px;
    transition: all 0.3s;
}

.metodo-efectivo {
    background: #27ae60;
    color: white;
}

.metodo-credito {
    background: #f39c12;
    color: white;
}

.efectivo-div {
    margin-top: 8px;
}

.cambio {
    font-size: 15px;
    font-weight: bold;
    color: #27ae60;
    background: #f5f0f5;
    padding: 6px 10px;
    border-radius: 6px;
    text-align: center;
    margin-top: 6px;
}

select,
input[type="number"] {
    padding: 5px 8px;
    border: 2px solid #e8e0e5;
    border-radius: 6px;
    width: 100%;
    font-size: 12px;
    transition: border-color 0.3s;
    -webkit-appearance: none;
    appearance: none;
}

select:focus,
input[type="number"]:focus {
    border-color: #940035;
    outline: none;
}

.btn-cobrar {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    font-size: 15px;
    font-weight: 700;
    background: linear-gradient(135deg, #D4AF37, #b8942e);
    color: #3d0015;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-cobrar:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px rgba(212, 175, 55, 0.4);
}

.carrito-contenido {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 8px;
    max-height: 300px;
}

/* ======================================== */
/* RESPONSIVE - TABLETS Y ESCRITORIO */
/* ======================================== */
@media (min-width: 768px) {
    .dashboard-container {
        flex-direction: row;
    }

    .sidebar {
        width: 250px;
        min-height: 100vh;
        position: sticky;
        top: 0;
        padding: 20px 15px;
    }

    .sidebar nav {
        flex-direction: column;
        align-items: stretch;
        flex-wrap: nowrap;
        gap: 2px;
    }

    .sidebar nav a {
        display: block;
        padding: 10px 14px;
        font-size: 14px;
        white-space: normal;
    }

    .main-content {
        padding: 20px 25px;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }

    .stat-card .value {
        font-size: 28px;
    }

    .ventas-container {
        flex-direction: row;
        gap: 20px;
        min-height: calc(100vh - 120px);
    }

    .productos-lista {
        flex: 1;
        min-width: 300px;
        height: calc(100vh - 120px);
        overflow-y: auto;
        order: 1;
    }

    .carrito {
        flex: 3.2;
        min-width: 280px;
        max-width: 450px;
        height: calc(100vh - 120px);
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        order: 2;
    }

    .productos-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }

    .producto-btn {
        padding: 10px 8px;
        font-size: 12px;
    }

    .producto-btn .precio {
        font-size: 13px;
    }

    .tabla-carrito {
        font-size: 11px;
    }

    .carrito-contenido {
        max-height: 400px;
    }

    .data-table table {
        min-width: 700px;
    }

    .top-bar {
        padding: 12px 25px;
    }

    .user-info {
        font-size: 14px;
    }

    .login-box {
        padding: 40px;
    }
}

@media (min-width: 1024px) {
    .sidebar {
        width: 280px;
    }

    .stats-grid {
        gap: 25px;
    }

    .stat-card {
        padding: 25px;
    }

    .stat-card .value {
        font-size: 32px;
    }
}

/* ======================================== */
/* UTILIDADES PARA MÓVILES */
/* ======================================== */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 10px 8px;
    }

    .stat-card .value {
        font-size: 17px;
    }

    .stat-card h3 {
        font-size: 9px;
    }

    .stat-card small {
        font-size: 8px;
    }

    .productos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 5px;
    }

    .producto-btn {
        font-size: 10px;
        padding: 6px 4px;
    }

    .producto-btn .precio {
        font-size: 10px;
    }

    .sidebar nav a {
        font-size: 10px;
        padding: 4px 8px;
    }

    .sidebar h2 {
        font-size: 15px;
    }

    .top-bar {
        padding: 8px 12px;
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .user-info {
        font-size: 12px;
    }

    .logout-btn {
        font-size: 11px;
        padding: 5px 12px;
        text-align: center;
    }

    .btn {
        font-size: 12px;
        padding: 6px 12px;
        min-height: 34px;
    }

    .data-table .table-title {
        font-size: 12px;
        padding: 10px 12px;
    }

    .data-table th,
    .data-table td {
        font-size: 10px;
        padding: 5px 6px;
    }

    .data-table table {
        min-width: 500px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        /* Evita zoom en iOS */
        padding: 10px 12px;
    }

    .login-box {
        padding: 20px 15px;
    }

    .login-box h1 {
        font-size: 18px;
    }

    .login-box input {
        font-size: 16px;
        padding: 10px 12px;
    }

    .carrito-total {
        font-size: 13px;
    }

    .cambio {
        font-size: 13px;
    }

    .metodo-opcion {
        font-size: 10px;
        padding: 4px 6px;
    }

    .btn-cobrar {
        font-size: 13px;
        padding: 8px;
    }

    .bienvenida {
        padding: 15px !important;
        flex-direction: column !important;
        text-align: center !important;
    }

    .bienvenida h2 {
        font-size: 17px !important;
    }

    .bienvenida p {
        font-size: 12px !important;
    }

    .resumen-caja .resumen-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .resumen-item .value {
        font-size: 16px !important;
    }

    .resumen-item .label {
        font-size: 9px !important;
    }

    .stats-cards {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .stat-card-producto .valor {
        font-size: 20px !important;
    }
}

/* ======================================== */
/* BIENVENIDA DASHBOARD */
/* ======================================== */
.bienvenida {
    background: linear-gradient(135deg, #940035, #6b0027);
    color: white;
    padding: 20px 25px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.bienvenida h2 {
    margin: 0;
    font-size: 20px;
}

.bienvenida h2 span {
    color: #D4AF37;
}

.bienvenida p {
    margin: 5px 0 0 0;
    opacity: 0.8;
    font-size: 13px;
}

.bienvenida .fecha {
    font-size: 13px;
    opacity: 0.8;
    text-align: right;
}

.badge-gold {
    background: #D4AF37;
    color: #3d0015;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 11px;
}

/* ======================================== */
/* RESULTADOS DE BÚSQUEDA */
/* ======================================== */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card-producto {
    background: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.stat-card-producto:hover {
    transform: translateY(-3px);
}

.stat-card-producto .icono {
    font-size: 28px;
    margin-bottom: 5px;
}

.stat-card-producto .titulo {
    font-size: 10px;
    color: #7f8c8d;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.stat-card-producto .valor {
    font-size: 22px;
    font-weight: bold;
    color: #2c3e50;
}

.stat-card-producto .sub {
    font-size: 10px;
    color: #95a5a6;
    margin-top: 3px;
}

/* ======================================== */
/* RESULTADOS DE BÚSQUEDA */
/* ======================================== */
.buscador-producto {
    background: white;
    padding: 15px 18px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.buscador-producto input {
    flex: 1;
    padding: 10px 14px;
    font-size: 15px;
    border: 2px solid #e8e0e5;
    border-radius: 6px;
    width: 100%;
}

.buscador-producto input:focus {
    border-color: #940035;
    outline: none;
}

.info-producto {
    background: linear-gradient(135deg, #940035, #6b0027);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.info-producto h2 {
    margin: 0 0 8px 0;
    font-size: 18px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.info-item {
    background: rgba(255,255,255,0.15);
    padding: 10px;
    border-radius: 6px;
}

.info-item .label {
    font-size: 9px;
    opacity: 0.8;
    text-transform: uppercase;
}

.info-item .value {
    font-size: 18px;
    font-weight: bold;
}

/* ======================================== */
/* RESULTADOS DE BÚSQUEDA */
/* ======================================== */
@media (min-width: 768px) {
    .info-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}