/* Paleta Dual (Sidebar Oscuro + Contenido Claro) */
:root {
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-text: #f8fafc;
    --sidebar-text-muted: #94a3b8;
    
    --bg-base: #f1f5f9;
    --bg-surface: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    
    --accent-blue: #2563eb;
    --accent-blue-hover: #1d4ed8;
    --danger: #ef4444;
    --success: #10b981;
    
    --sidebar-width: 260px;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px 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);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow-x: hidden;
}

.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    pointer-events: none;
}

#app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 50;
    color: var(--sidebar-text);
}
.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-header img { width: 40px; }
.sidebar-nav {
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--sidebar-text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    text-decoration: none;
}
.nav-item img { width: 20px; height: 20px; opacity: 0.6; filter: invert(1); }
.nav-item:hover, .nav-item.active {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-text);
}
.nav-item.active img { opacity: 1; }

/* --- CONTENIDO PRINCIPAL --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    position: relative;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 5%;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: var(--shadow-sm);
}
.menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}
.cart-btn {
    background: none;
    border: 1px solid var(--border-color);
    cursor: pointer;
    position: relative;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cart-btn:hover { background-color: var(--bg-base); }
.cart-btn img { width: 24px; height: 24px; }
.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--accent-blue);
    color: #fff;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-logout {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    display: none;
}
.btn-logout:hover { background-color: var(--bg-base); color: var(--text-primary); }

/* --- SKELETON ANIMATION --- */
@keyframes shimmer {
    0% { background-position: -468px 0; }
    100% { background-position: 468px 0; }
}
.skeleton-box {
    background: #f1f5f9;
    background-image: linear-gradient(to right, #f1f5f9 0%, #e2e8f0 20%, #f1f5f9 40%, #f1f5f9 100%);
    background-repeat: no-repeat;
    background-size: 800px 100%;
    animation-duration: 1.5s;
    animation-fill-mode: forwards;
    animation-iteration-count: infinite;
    animation-name: shimmer;
    animation-timing-function: linear;
    border-radius: 6px;
}
.card-skeleton-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-surface);
    z-index: 15;
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s ease;
}

/* --- PANEL DE CARRITO --- */
.cart-panel {
    position: fixed;
    top: 0; right: -380px; width: 380px; height: 100vh;
    background-color: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    z-index: 100;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}
.cart-panel.open { right: 0; }
.cart-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cart-close { background: none; border: none; color: var(--text-secondary); font-size: 1.5rem; cursor: pointer; }
.cart-items {
    flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
}
.cart-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px; background-color: var(--bg-base); border-radius: 8px; border: 1px solid var(--border-color);
}
.item-info { display: flex; flex-direction: column; }
.cart-item-title { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.cart-item-price { font-size: 0.85rem; color: var(--text-secondary); }

.btn-remove {
    background-color: transparent; color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3); padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 0.8rem;
    transition: all 0.2s; display: flex; align-items: center; gap: 6px;
}
.btn-remove:hover { background-color: var(--danger); color: white; }

.cart-summary {
    padding: 20px; background-color: var(--bg-base); border-top: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 8px;
}
.summary-row { display: flex; justify-content: space-between; font-size: 0.95rem; color: var(--text-secondary); }
.summary-row.discount { color: var(--success); font-weight: 600; }
.summary-row.total {
    font-size: 1.25rem; font-weight: bold; color: var(--text-primary);
    margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border-color);
}
.cart-footer { padding: 20px; border-top: 1px solid var(--border-color); }

.btn-checkout {
    display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 14px;
    background-color: var(--accent-blue); color: #fff; border: none; border-radius: 8px; font-weight: bold; font-size: 1rem;
    cursor: pointer; transition: background-color 0.2s; box-shadow: var(--shadow-sm);
}
.btn-checkout:hover { background-color: var(--accent-blue-hover); }
.btn-checkout img { width: 20px; height: 20px; filter: invert(1); } 

.section-view { display: none; padding: 32px 5%; max-width: 1200px; margin: 0 auto; width: 100%; }
.section-view.active { display: block; }
.section-title { font-size: 1.5rem; color: var(--text-primary); margin-bottom: 24px; font-weight: 700; }

/* Grid Servicios */
.access-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px;
}
.card {
    background-color: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 12px; padding: 24px;
    display: flex; flex-direction: column; box-shadow: var(--shadow-sm); transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    position: relative; overflow: hidden; 
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--accent-blue); }
.card-header { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }

.icon-wrapper {
    width: 54px; height: 54px; border-radius: 12px; background-color: var(--bg-base);
    display: flex; align-items: center; justify-content: center; border: 1px solid var(--border-color); overflow: hidden; padding: 8px;
}
.brand-logo { width: 100%; height: 100%; object-fit: contain; }

.card-title { font-size: 1.1rem; font-weight: 600; color: var(--text-primary); }
.card-price { font-size: 1.25rem; font-weight: bold; color: var(--text-primary); margin-bottom: 12px; }

.card-status {
    font-size: 0.8rem; padding: 6px 10px; border-radius: 6px; background-color: var(--bg-base); color: var(--text-secondary);
    margin-bottom: 20px; display: inline-block; width: fit-content; border: 1px solid var(--border-color); font-weight: 500;
}

.card-actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.btn-icon { width: 18px; height: 18px; object-fit: contain; }

.btn-info {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 10px;
    background-color: var(--bg-base); color: var(--text-primary); border: 1px solid var(--border-color);
    border-radius: 8px; font-weight: 500; font-size: 0.9rem; cursor: pointer; transition: all 0.2s;
}
.btn-info:hover { background-color: var(--border-color); }

.btn-action {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px;
    background-color: var(--bg-surface); color: var(--accent-blue); border: 2px solid var(--accent-blue);
    border-radius: 8px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-action.added { background-color: var(--bg-base); border-color: var(--danger); color: var(--danger); }
.btn-action:hover:not(.added) { background-color: var(--accent-blue); color: white; }
.btn-action:hover:not(.added) .btn-icon { filter: brightness(0) invert(1); }

@keyframes popIn {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3); width: 40px; height: 40px; border-radius: 50%;
    border-left-color: var(--accent-blue); animation: spin 1s linear infinite; margin: 0 auto 20px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .sidebar { position: fixed; left: -100%; height: 100vh; }
    .sidebar.open { left: 0; }
    .menu-btn { display: block; }
    .cart-panel { width: 100%; right: -100%; }
}

/* --- ESTILOS OSCUROS PARA MODALES DE CONFIRMACIÓN Y ÉXITO --- */
.panel-oscuro {
    background-color: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 24px;
    color: #f1f5f9; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2); max-width: 500px; margin: 0 auto; width: 100%;
}
.icono-mediano { width: 64px; height: 64px; margin: 0 auto 16px auto; display: block; }
.icono-pequeno { width: 20px; height: 20px; margin-right: 10px; }

.titulo-exito { color: #10b981; font-size: 1.5rem; margin-bottom: 16px; } 
.titulo-error { color: #ef4444; font-size: 1.5rem; margin-bottom: 16px; } 

.detalle-orden, .detalle-comprobante { background-color: #0f172a; padding: 16px; border-radius: 8px; border: 1px solid #334155; }
.flex-align { display: flex; align-items: center; margin-bottom: 8px; }
.flex-center { display: flex; align-items: center; justify-content: center; }

.grupo-input { display: flex; gap: 8px; }
.input-oscuro {
    flex: 1; background-color: #0f172a; border: 1px solid #334155; color: #f1f5f9; padding: 10px 14px; border-radius: 6px; outline: none;
}
.input-oscuro:focus { border-color: #2563eb; }

.btn-primario, .btn-secundario, .btn-texto-mod {
    padding: 12px 20px; border-radius: 6px; font-weight: bold; cursor: pointer; border: none; text-decoration: none; transition: background-color 0.2s; width: 100%;
}
.btn-primario { background-color: #2563eb; color: white; }
.btn-primario:hover { background-color: #1d4ed8; }
.btn-secundario { background-color: #334155; color: white; }
.btn-secundario:hover { background-color: #475569; }
.btn-texto-mod { background: transparent; color: #94a3b8; }
.btn-texto-mod:hover { color: #f1f5f9; }

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(15, 23, 42, 0.7);
    display: flex; align-items: center; justify-content: center; z-index: 10000; backdrop-filter: blur(3px);
}