:root {
  --bg-main: #030712;
  --sidebar-bg: #070d19;
  --card-bg: rgba(15, 23, 42, 0.85);
  --border-color: rgba(30, 41, 59, 0.9);
  --neon-blue: #38bdf8;
  --neon-green: #34d399;
  --neon-yellow: #ffb020;
  --neon-red: #f87171;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --gradient-primary: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, -apple-system, sans-serif; }
body { background-color: var(--bg-main); color: var(--text-main); display: flex; min-height: 100vh; overflow-x: hidden; width: 100%; }

#sparkles-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.sparkle { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; animation: sparkleAnim 3s infinite ease-in-out; opacity: 0.6; }
@keyframes sparkleAnim { 0%, 100% { opacity: 0.2; transform: scale(0.6); } 50% { opacity: 1; transform: scale(1.5); } }

aside.sidebar {
  width: 260px; background: var(--sidebar-bg); border-right: 1px solid var(--border-color);
  display: flex; flex-direction: column; justify-content: space-between; padding: 25px 0; flex-shrink: 0; z-index: 10;
  box-shadow: 4px 0 25px rgba(0,0,0,0.5); backdrop-filter: blur(10px); position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.logo { text-align: center; padding: 0 20px 22px; border-bottom: 1px solid var(--border-color); font-size: 1.25rem; font-weight: 800; color: #fff; line-height: 1.3; }
.logo img { max-height: 40px; display: block; margin: 0 auto 8px auto; object-fit: contain; }
.logo span { background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.menu { list-style: none; margin-top: 20px; padding: 0 10px; }
.menu-item {
  padding: 13px 16px; display: flex; align-items: center; gap: 12px; cursor: pointer; color: var(--text-muted); font-size: 0.88rem; font-weight: 500;
  border-radius: 10px; transition: all 0.25s ease; margin-bottom: 4px;
}
.menu-item:hover { color: #fff; background: rgba(56, 189, 248, 0.08); transform: translateX(4px); }
.menu-item.active { color: #fff; background: var(--gradient-primary); box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3); font-weight: 600; }

main.main-content { flex: 1; padding: 30px 40px 100px; z-index: 1; overflow-y: auto; background: radial-gradient(circle at top right, #0b1329 0%, #030712 60%); min-width: 0; }
header.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; flex-wrap: wrap; gap: 15px; border-bottom: 1px solid var(--border-color); padding-bottom: 20px; }
header.top-bar h2 { font-size: 1.6rem; font-weight: 700; }
.user-pill { background: rgba(56, 189, 248, 0.1); border: 1px solid rgba(56, 189, 248, 0.3); color: var(--neon-blue); padding: 7px 16px; border-radius: 30px; font-size: 0.82rem; font-weight: 700; }

.view-section { display: none; }
.view-section.active { display: block; }

input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], select, textarea, .input-neon {
  width: 100%; padding: 12px 16px; background-color: rgba(3, 7, 18, 0.9) !important; color: #fff !important;
  border: 1px solid var(--border-color); border-radius: 10px; font-size: 0.88rem; outline: none; transition: all 0.2s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--neon-blue) !important; box-shadow: 0 0 12px rgba(56, 189, 248, 0.25) !important; background-color: #030712 !important; }
.input-readonly { background: rgba(15, 23, 42, 0.9) !important; color: var(--neon-blue) !important; font-weight: 600; cursor: not-allowed; border-color: rgba(56, 189, 248, 0.2); }
input[type="checkbox"] { accent-color: var(--neon-blue); }

.btn-toggle-form {
  background: var(--gradient-primary); color: #fff; border: none; padding: 12px 22px;
  border-radius: 10px; font-weight: 600; font-size: 0.88rem; cursor: pointer; margin-bottom: 25px; display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3); transition: all 0.2s ease;
}
.btn-toggle-form:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4); filter: brightness(1.1); }

.btn-stock-card {
  background: transparent; border: 1px solid var(--neon-blue); color: var(--neon-blue);
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 600; transition: all 0.2s ease;
}
.btn-stock-card:hover { background: rgba(56, 189, 248, 0.15); }

.btn-reactivar {
  background: rgba(52, 211, 153, 0.15); border: 1px solid var(--neon-green); color: var(--neon-green);
  padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 0.8rem; font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px; transition: all 0.2s ease;
}
.btn-reactivar:hover { background: var(--neon-green); color: #030712; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(52, 211, 153, 0.3); }

.btn-liberar-creativo {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  border: none;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.35);
  transition: all 0.25s ease;
  width: 100%;
}
.btn-liberar-creativo:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
  box-shadow: 0 6px 25px rgba(245, 158, 11, 0.5);
}

.form-registro { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 16px; padding: 25px; margin-bottom: 30px; backdrop-filter: blur(12px); box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.form-label, label { color: #cbd5e1; font-size: 0.82rem; font-weight: 600; margin-bottom: 6px; display: block; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 30px; }
.kpi-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 16px; padding: 24px; text-align: center; cursor: pointer; transition: all 0.25s ease; backdrop-filter: blur(12px); box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.kpi-card:hover { transform: translateY(-5px); border-color: var(--neon-blue); box-shadow: 0 12px 30px rgba(56, 189, 248, 0.15); }
.kpi-number { font-size: 2.4rem; font-weight: 800; margin-bottom: 6px; color: var(--neon-green); }
.kpi-label { font-size: 0.88rem; color: var(--text-muted); font-weight: 600; }

.tabla-wrapper { overflow-x: auto; overflow-y: auto; max-height: 500px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 16px; backdrop-filter: blur(12px); box-shadow: 0 8px 32px rgba(0,0,0,0.3); width: 100%; position: relative;}
.tabla-wrapper::-webkit-scrollbar { width: 8px; height: 8px; }
.tabla-wrapper::-webkit-scrollbar-track { background: rgba(3, 7, 18, 0.5); border-radius: 8px; }
.tabla-wrapper::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 8px; }
.tabla-wrapper::-webkit-scrollbar-thumb:hover { background: var(--neon-blue); }

table.tabla-servicios { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.85rem; }
table.tabla-servicios th { background: rgba(7, 13, 25, 0.95); padding: 15px 18px; color: var(--neon-blue); font-weight: 700; border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 2; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
table.tabla-servicios td { padding: 15px 18px; border-bottom: 1px solid rgba(30, 41, 59, 0.5); color: #e2e8f0; vertical-align: middle; }
table.tabla-servicios tr:hover td { background: rgba(56, 189, 248, 0.03); }

.badge-estado { padding: 5px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 700; display: inline-block; }
.badge-ok { background: rgba(52, 211, 153, 0.15); color: var(--neon-green); border: 1px solid rgba(52, 211, 153, 0.3); }
.badge-danger { background: rgba(248, 113, 113, 0.15); color: var(--neon-red); border: 1px solid rgba(248, 113, 113, 0.3); }

.btn-accion-group { display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn-accion {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px; border: none; margin: 0 2px;
  transition: all 0.2s ease; text-decoration: none; cursor: pointer; flex-shrink: 0; box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.btn-accion svg { width: 16px; height: 16px; fill: currentColor; pointer-events: none; }
.btn-accion:hover { transform: scale(1.12); filter: brightness(1.2); }

.btn-whatsapp { background-color: #10b981; color: #fff; }
.btn-editar { background-color: var(--neon-blue); color: #030712; font-weight: bold; }
.btn-eliminar { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid #ef4444; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 12px; transition: all 0.2s ease; }
.btn-eliminar:hover { background: #ef4444; color: #fff; }

.btn-toggle-pwd { background: none; border: none; color: var(--neon-blue); cursor: pointer; padding: 0 5px; font-size: 1rem; transition: transform 0.2s; }
.btn-toggle-pwd:hover { transform: scale(1.2); filter: brightness(1.2); }

#toast-container { position: fixed; bottom: 25px; right: 25px; z-index: 9999; display: flex; flex-direction: column; gap: 12px; }
.toast { background: var(--card-bg); border-left: 4px solid var(--neon-blue); color: #fff; padding: 16px 20px; border-radius: 8px; box-shadow: 0 8px 25px rgba(0,0,0,0.5); backdrop-filter: blur(10px); display: flex; align-items: center; gap: 12px; font-size: 0.9rem; font-weight: 600; animation: slideInRight 0.3s ease forwards; min-width: 280px; }
.toast.success { border-color: var(--neon-green); }
.toast.error { border-color: var(--neon-red); }
@keyframes slideInRight { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-10px); } }

.store-public-container { background: #0b0f19; border: 1px solid var(--border-color); border-radius: 20px; overflow: hidden; box-shadow: 0 15px 40px rgba(0,0,0,0.6); position: relative; margin-top: 20px; }
.store-nav-bar { background: #020408; padding: 20px 30px; display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--neon-blue); }
.store-nav-brand { font-size: 1.4rem; font-weight: 800; color: #fff; display: flex; align-items: center; gap: 10px; }
.store-nav-brand span { color: var(--neon-blue); }
.store-hero { background: linear-gradient(rgba(3,7,18,0.7), rgba(3,7,18,0.9)), #070d19; padding: 50px 20px; text-align: center; border-bottom: 1px solid var(--border-color); }
.store-hero h1 { font-size: 2.2rem; font-weight: 900; color: #fff; margin-bottom: 10px; letter-spacing: -0.5px; }
.store-hero p { color: var(--text-muted); font-size: 0.95rem; max-width: 600px; margin: 0 auto; }

.store-catalog-section { padding: 40px 30px; }
.store-catalog-title { font-size: 1.3rem; font-weight: 800; color: #fff; margin-bottom: 25px; border-left: 4px solid var(--neon-blue); padding-left: 12px; }

.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 25px; margin-bottom: 30px; }
.store-card { background: #0f172a; border: 1px solid var(--border-color); border-radius: 14px; overflow: hidden; text-align: center; transition: all 0.3s ease; box-shadow: 0 8px 25px rgba(0,0,0,0.4); display: flex; flex-direction: column; justify-content: space-between; }
.store-card:hover { transform: translateY(-5px); border-color: var(--neon-blue); box-shadow: 0 12px 30px rgba(56, 189, 248, 0.2); }
.store-card-img { width: 100%; height: 180px; object-fit: cover; background: #030712; border-bottom: 1px solid var(--border-color); }
.store-card-body { padding: 20px; display: flex; flex-direction: column; flex-grow: 1; justify-content: space-between; }
.store-card h4 { color: #fff; margin-bottom: 8px; font-size: 1.1rem; font-weight: 700; }
.store-card p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 15px; }
.store-price { color: var(--neon-green); font-size: 1.1rem; font-weight: 800; margin-bottom: 15px; }

.btn-buy-pro { background: var(--gradient-primary); color: #fff; border: none; padding: 12px 20px; border-radius: 8px; font-weight: 700; cursor: pointer; width: 100%; transition: 0.2s; box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3); }
.btn-buy-pro:hover { filter: brightness(1.15); transform: scale(1.02); }

.whatsapp-float {
  position: fixed; bottom: 25px; right: 25px; background-color: #25d366; color: #fff; width: 60px; height: 60px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 20px rgba(37, 211, 102, 0.5);
  z-index: 999; transition: transform 0.3s ease; text-decoration: none;
}
.whatsapp-float:hover { transform: scale(1.1); }
.whatsapp-float svg { width: 35px; height: 35px; fill: #fff; }

.store-footer { background: #020408; color: #fff; padding: 30px; text-align: center; border-top: 1px solid var(--border-color); }
.store-footer p { color: var(--text-muted); font-size: 0.85rem; }

.form-group-inline { display: flex; gap: 10px; margin-bottom: 20px; align-items: center; }
.form-group-inline input { flex: 1; padding: 10px 15px; background: #121824; border: 1px solid #1e293b; border-radius: 8px; color: #fff; height: 42px; }
.form-group-inline .btn-toggle-form { height: 42px; margin-bottom: 0; padding: 0 20px; white-space: nowrap; }
.tabla-plataformas-container { background: #121824; border-radius: 8px; border: 1px solid #1e293b; overflow: hidden; }
.tabla-header-plat { display: flex; justify-content: space-between; padding: 12px 20px; font-size: 12px; font-weight: bold; color: #8a99ad; border-bottom: 1px solid #1e293b; }
.lista-plataformas { max-height: 200px; overflow-y: auto; }
.plataforma-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-bottom: 1px solid #1e293b; color: #fff; }
.plataforma-item:last-child { border-bottom: none; }

/* =========================================================
   MENÚ LATERAL MÓVIL (TIPO APP DESPLEGABLE)
========================================================= */
/* Ocultar el botón de 3 rayitas en la computadora */
.btn-menu-movil { display: none; }

@media screen and (max-width: 900px) {
    body {
        display: block !important;
        overflow-x: hidden !important;
        width: 100% !important;
    }

    /* 1. Ajustes del botón de las 3 rayitas (Hamburguesa) */
    .btn-menu-movil {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: rgba(15, 23, 42, 0.8) !important;
        border: 1px solid var(--neon-blue) !important;
        border-radius: 10px !important;
        color: var(--neon-blue) !important;
        font-size: 1.5rem !important;
        cursor: pointer;
        padding: 6px 14px !important;
        margin-right: 15px !important;
        box-shadow: 0 4px 10px rgba(56, 189, 248, 0.2) !important;
    }

    /* 2. El panel lateral (Escondido a la izquierda por defecto) */
    body aside.sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -320px !important; /* Escondido fuera de la pantalla */
        width: 280px !important;
        height: 100vh !important;
        background: #070d19 !important; /* Fondo súper oscuro */
        z-index: 999999 !important; /* Por encima de todo */
        transition: left 0.3s ease-in-out !important; /* Animación de entrada suave */
        border-right: 2px solid var(--neon-blue) !important;
        border-bottom: none !important;
        padding: 20px 10px !important;
        display: flex !important;
        flex-direction: column !important;
        box-shadow: 15px 0 30px rgba(0,0,0,0.8) !important;
    }

    /* 3. La magia que lo abre cuando tocas el botón */
    body aside.sidebar.abierto {
        left: 0 !important;
    }

    /* 4. Asegurar que el logo y las opciones se vean como lista hacia abajo */
    body aside.sidebar .logo {
        display: block !important;
        margin-bottom: 20px !important;
    }

    body aside.sidebar .menu {
        display: flex !important;
        flex-direction: column !important;
        overflow-y: auto !important;
        white-space: normal !important;
        margin-top: 10px !important;
        padding: 0 5px !important;
    }

    body aside.sidebar .menu-item {
        display: flex !important;
        width: 100% !important;
        margin-bottom: 8px !important;
        padding: 14px 20px !important;
        text-align: left !important;
        font-size: 0.95rem !important; /* Texto un poco más grande para el dedo */
    }

    /* 5. Ajustar el contenido principal para que use todo el ancho en móvil */
    main.main-content {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 15px !important;
    }
}
/* --- PAGINACIÓN ESTILO CLÁSICO --- */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}
.btn-page {
    background: #0f172a;
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #e2e8f0;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.btn-page:hover:not(:disabled) {
    background: rgba(56, 189, 248, 0.1);
    border-color: var(--neon-blue);
    color: var(--neon-blue);
}
.btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.page-info {
    color: #e2e8f0;
    font-size: 0.9rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 16px;
    border-radius: 8px;
}

/* --- MENÚ LATERAL MÓVIL TIPO APP (FOTOS 3 Y 4) --- */
@media screen and (max-width: 900px) {
  body {
    display: block !important;
    overflow-x: hidden !important;
    width: 100% !important;
  }

  /* Fuerza al menú a ser una barra lateral izquierda oculta */
  body aside.sidebar {
    position: fixed !important;
    top: 0 !important;
    left: -350px !important; /* Escondido fuera de la pantalla */
    width: 270px !important;
    height: 100vh !important;
    background: #0a0e17 !important; /* Fondo oscuro exacto a tu foto 4 */
    z-index: 999999 !important; /* Superpuesto por encima de todo */
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-right: 1px solid var(--neon-blue) !important;
    border-bottom: none !important;
    padding: 20px 10px !important;
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    box-shadow: 15px 0 30px rgba(0,0,0,0.9) !important;
  }

  /* Clase mágica que lo abre */
  body aside.sidebar.abierto {
    left: 0 !important;
  }

  /* Formato de las opciones alineadas a la izquierda */
  body aside.sidebar .menu {
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    white-space: normal !important;
    margin-top: 10px !important;
  }

  body aside.sidebar .menu-item {
    display: flex !important;
    width: 100% !important;
    margin-bottom: 5px !important;
    padding: 12px 15px !important;
    text-align: left !important;
  }

  main.main-content {
    width: 100% !important;
    margin-left: 0 !important;
    padding: 15px !important;
  }
}

/* Ocultar botón en computadora */
.btn-menu-movil {
  display: none; 
}

/* Diseño del botón cuadrado de tu Foto 3 */
@media screen and (max-width: 900px) {
  .btn-menu-movil {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: #0f172a !important; /* Cuadro interior oscuro */
    border: 1px solid rgba(56, 189, 248, 0.3) !important; /* Borde tenue */
    border-radius: 12px !important; /* Bordes redondeados */
    color: #fff !important; /* 3 Rayitas blancas */
    font-size: 1.8rem !important;
    cursor: pointer;
    margin-right: 15px !important;
    padding: 8px 12px !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3) !important;
  }
}

#checkoutModal {
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px !important;
}
/* Ocultar elementos exclusivos de Admin de forma inmediata si es revendedor o empleado */
body.is-revendedor .menu-admin-only,
body.is-revendedor #adminConfigEmpleados,
body.is-revendedor #adminConfigPagos,
body.is-revendedor #adminConfigImagenes,
body.is-revendedor #adminConfigPrecios,
body.is-revendedor #adminConfigCredenciales,
body.is-revendedor #adminConfigServidor,
body.is-revendedor #adminConfigPlataformas {
  display: none !important;
}

/* --- AJUSTES EXCLUSIVOS PARA LA TABLA DE CLIENTES (EVITA DAÑAR EL DASHBOARD) --- */
@media screen and (min-width: 901px) {
    /* 1. Apretar la columna del # y empujar el número contra la derecha */
    #viewClientes .tabla-servicios th:nth-child(1),
    #viewClientes .tabla-servicios td:nth-child(1) {
        width: 1% !important; 
        white-space: nowrap !important;
        padding-right: 8px !important; 
        text-align: right !important; 
    }
    
    /* 2. Quitarle el muro invisible (padding) al lado izquierdo del Cliente */
    #viewClientes .tabla-servicios th:nth-child(2),
    #viewClientes .tabla-servicios td:nth-child(2) {
        padding-left: 0px !important; 
    }

    /* 3. Juntar columnas de Estado y Acciones al máximo */
    #viewClientes .tabla-servicios th:nth-last-child(2),
    #viewClientes .tabla-servicios td:nth-last-child(2) {
        width: 1% !important;
        white-space: nowrap !important;
        padding-right: 4px !important;
        text-align: right !important; 
    }

    #viewClientes .tabla-servicios th:last-child,
    #viewClientes .tabla-servicios td:last-child {
        width: 1% !important;
        white-space: nowrap !important;
        padding-left: 0px !important;
        text-align: left !important; 
    }

    #viewClientes .tabla-servicios td:last-child .btn-accion-group {
        justify-content: flex-start !important;
    }
}