/* Tema base de la app - Dark Modern Mobile Style */
:root {
  --brand: #2563eb;
  --brand-dark: #1e40af;
  --bg: #1f2128; /* Fondo oscuro App */
  --text: #ffffff; /* Texto claro */
  --text-secondary: #9ca3af;
  --card-bg: #2a2d3e; /* Fondo tarjetas */
  --card-border: #374151;
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 64px;
  --sidebar-bg: #1f2128;
  --sidebar-text: #f9fafb;
  
  /* Accent Colors (Old) - Kept for reference, overwritten below */
  --accent-cyan: #00d2d3;
  --accent-purple: #5f27cd;
  --accent-yellow: #ff9f43;
  --accent-red: #ff6b6b;

  /* New Palette */
  --p-1: #20c2cd; /* Cyan-ish */
  --p-2: #5b5da7; /* Purple-ish */
  --p-3: #d8b04e; /* Yellow-ish */
  --p-4: #1e626b; /* Dark Teal */
  --p-5: #353b5b; /* Dark Blue/Purple */
  --p-6: #2f5972; /* Dark Blue/Grey */
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: 70px; /* Espacio para navbar fija */
}

/* Typography & General */
h1, h2, h3, h4, h5, h6 { font-weight: 700; color: var(--text); }
a { text-decoration: none; color: inherit; }
a:hover { color: var(--brand); }

/* Utility Classes for Palette */
.bg-p-1 { background-color: var(--p-1) !important; color: white; }
.bg-p-2 { background-color: var(--p-2) !important; color: white; }
.bg-p-3 { background-color: var(--p-3) !important; color: white; }
.bg-p-4 { background-color: var(--p-4) !important; color: white; }
.bg-p-5 { background-color: var(--p-5) !important; color: white; }
.bg-p-6 { background-color: var(--p-6) !important; color: white; }

.text-p-1 { color: var(--p-1) !important; }
.text-p-2 { color: var(--p-2) !important; }
.text-p-3 { color: var(--p-3) !important; }
.text-p-4 { color: var(--p-4) !important; }
.text-p-5 { color: var(--p-5) !important; }
.text-p-6 { color: var(--p-6) !important; }

/* Block Backgrounds for Test/Temarios blocks */
.block-bg-1 { --block-color: var(--p-1); border-left: 5px solid var(--block-color); }
.block-bg-2 { --block-color: var(--p-2); border-left: 5px solid var(--block-color); }
.block-bg-3 { --block-color: var(--p-3); border-left: 5px solid var(--block-color); }
.block-bg-4 { --block-color: var(--p-4); border-left: 5px solid var(--block-color); }
.block-bg-5 { --block-color: var(--p-5); border-left: 5px solid var(--block-color); }
.block-bg-6 { --block-color: var(--p-6); border-left: 5px solid var(--block-color); }

#temariosGroups .temarios-block, #supuestosGroups .temarios-block, #testGroups .temarios-block { padding-left: 10px; padding-right: 10px; }

.badge-acq-nonzero {
  background-color: rgba(245, 178, 90, 0.95) !important;
  color: #1f2128 !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
}

#temariosGroups .card.acquired,
#supuestosGroups .card.acquired,
#testGroups .card.acquired {
  background: rgba(34, 197, 94, 0.22) !important;
  border-color: rgba(34, 197, 94, 0.95) !important;
  border-left: 6px solid rgba(34, 197, 94, 1) !important;
  box-shadow: 0 10px 22px rgba(0,0,0,0.25), 0 0 0 2px rgba(34, 197, 94, 0.25) !important;
}
#temariosGroups .card.acquired .card-body,
#supuestosGroups .card.acquired .card-body,
#testGroups .card.acquired .card-body {
  background: transparent !important;
}

/* Card Header coloring based on block-bg-X parent */
[class*="block-bg-"] .card-primary:not(.card-outline) > .card-header:not(.bg-success) {
    background-color: var(--block-color) !important;
    color: #fff;
}
[class*="block-bg-"] .card-primary.card-outline {
    border-top-color: var(--block-color) !important;
}

/* Components */
.card-modern {
  background: var(--card-bg);
  border-radius: 20px;
  border: none;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.card-modern:hover { transform: translateY(-3px); }

/* Circle Buttons (Top Row) */
.circle-btn-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}
.circle-btn {
  width: 80px;
  height: 80px;
  /* border-radius: 50%; removed: shape defined by SVG */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem; /* Reduced from 2rem */
  color: white;
  /* box-shadow: 0 4px 10px rgba(0,0,0,0.3); removed: SVG has shadow */
  transition: transform 0.2s;
  background: transparent !important; /* Override background colors */
  position: relative;
  box-sizing: border-box;
  padding: 0 !important;
}
.circle-btn:hover { transform: scale(1.05); }

/* SVG Icon styles */
.circle-btn .icon-main {
    position: relative;
    z-index: 2;
    width: 1.75rem;
    height: 1.75rem;
    stroke: white;
    stroke-width: 1.5; /* Fine stroke as requested */
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* SVG Background Logic */
.circle-btn svg.bg-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: visible; /* Allow shadow */
}
.circle-btn i {
    position: relative;
    z-index: 1;
    color: white; /* Ensure icons are white */
}

/* New explicit palette classes for circles - fill SVG */
.circle-btn.p-1 svg { fill: var(--p-1); }
.circle-btn.p-1 .st0, .circle-btn.p-1 .st1 { fill: var(--p-1); }

.circle-btn.p-2 svg { fill: var(--p-2); }
.circle-btn.p-2 .st0, .circle-btn.p-2 .st1 { fill: var(--p-2); }

.circle-btn.p-3 svg { fill: var(--p-3); }
.circle-btn.p-3 .st0, .circle-btn.p-3 .st1 { fill: var(--p-3); }

.circle-btn.p-4 svg { fill: var(--p-4); }
.circle-btn.p-4 .st0, .circle-btn.p-4 .st1 { fill: var(--p-4); }

.circle-btn.p-5 svg { fill: var(--p-5); }
.circle-btn.p-5 .st0, .circle-btn.p-5 .st1 { fill: var(--p-5); }

.circle-btn.p-6 svg { fill: var(--p-6); }
.circle-btn.p-6 .st0, .circle-btn.p-6 .st1 { fill: var(--p-6); }

/* Mapping old classes to new palette for compatibility/transition */
.circle-btn.cyan .st0, .circle-btn.cyan .st1 { fill: var(--p-1); }
.circle-btn.purple .st0, .circle-btn.purple .st1 { fill: var(--p-2); }
.circle-btn.yellow .st0, .circle-btn.yellow .st1 { fill: var(--p-3); }

.circle-label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }

/* Wide Action Cards (Middle) */
.action-card {
  border-radius: 20px;
  padding: 1.25rem;
  color: white;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}
/* Default action card style if not specified, or override specific ones */
.action-card.bg-gradient-cyan {
  background: linear-gradient(135deg, var(--p-1), var(--p-4));
}
.action-card.bg-gradient-p-1 {
  background: linear-gradient(135deg, var(--p-1), var(--p-4));
}
.action-card.bg-gradient-p-2 {
  background: linear-gradient(135deg, var(--p-2), var(--p-5));
}
.action-card.bg-gradient-p-3 {
  background: linear-gradient(135deg, var(--p-3), #b89c3a);
}
.action-card.bg-gradient-p-4 {
  background: linear-gradient(135deg, var(--p-4), var(--p-1));
}
.action-card.bg-gradient-p-5 {
  background: linear-gradient(135deg, var(--p-5), var(--p-2));
}
.action-card.bg-gradient-p-6 {
  background: linear-gradient(135deg, var(--p-6), #1c2a48);
}
.action-card.bg-gradient-offer {
  background: linear-gradient(135deg, var(--p-3), #ff7a00);
  box-shadow: 0 10px 20px rgba(0,0,0,0.25), 0 0 0 2px rgba(255, 122, 0, 0.28);
}
.text-offer {
  color: #ff7a00 !important;
}

@keyframes offerWiggle {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  15% { transform: translate3d(-1px, 0, 0) rotate(-0.7deg); }
  30% { transform: translate3d(1px, 0, 0) rotate(0.7deg); }
  45% { transform: translate3d(-1px, 0, 0) rotate(-0.6deg); }
  60% { transform: translate3d(1px, 0, 0) rotate(0.6deg); }
  75% { transform: translate3d(-1px, 0, 0) rotate(-0.4deg); }
  90% { transform: translate3d(1px, 0, 0) rotate(0.4deg); }
}
.action-card.is-offer-wiggle {
  transform-origin: 50% 50%;
  will-change: transform;
  animation: offerWiggle 1s ease-in-out 0s 10;
}
@media (prefers-reduced-motion: reduce) {
  .action-card.is-offer-wiggle { animation: none; }
}

.action-card .icon-box {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.action-card .content { flex: 1; }
.action-card.product-card { align-items: stretch; }
.action-card.product-card .content { display: flex; flex-direction: column; gap: 0.5rem; }
.action-card .btn-card-action {
  background: rgba(255,255,255,0.92);
  color: #111827;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  padding-left: 0.9rem;
  padding-right: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.action-card .btn-card-action:hover {
  background: rgba(255,255,255,1);
  color: #111827;
}
.action-card .btn-card-action svg {
  width: 1rem;
  height: 1rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
.action-card .confirm-popover {
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 16px;
  padding: 0.85rem;
}
.action-card .btn-card-action.is-success {
  background: rgba(34, 197, 94, 0.95);
  color: #fff;
  border-color: rgba(34, 197, 94, 0.95);
}
.action-card .btn-card-action.is-danger {
  background: rgba(239, 68, 68, 0.95);
  color: #fff;
  border-color: rgba(239, 68, 68, 0.95);
}

/* Banner Slider */
.home-slider .glide__slide img {
  border-radius: 15px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.glide__bullet {
  background-color: var(--text-secondary);
}
.glide__bullet--active {
  background-color: var(--brand);
}

/* Navbar Inferior (Mobile style) */
.bottom-navbar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background: var(--card-bg); /* Use card bg for navbar */
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
  z-index: 1040;
  border-top: 1px solid var(--card-border);
}
.nav-item-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-secondary);
  font-size: 0.75rem;
  gap: 4px;
  transition: color 0.2s;
}
.nav-item-link i { font-size: 1.25rem; margin-bottom: 2px; }
.nav-item-link.active, .nav-item-link:hover {
  color: var(--brand);
}

/* Admin Layout & Specifics (Optional overrides for AdminLTE) */
.content-wrapper { background: var(--bg) !important; }
.main-footer { background: var(--bg); border-top: 1px solid var(--card-border); color: var(--text-secondary); }
.main-header { border-bottom: 1px solid var(--card-border); }

/* Logo de marca en cabecera */
.admin-header .navbar-brand img.brand-logo,
.navbar .navbar-brand img.brand-logo {
  height: 50px;
  width: auto;
}

/* Grilla de cursos */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.course-grid .card {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--card-bg);
  transition: transform .12s ease, box-shadow .12s ease;
}
.course-grid .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.course-grid .card-title { font-weight: 600; }
.course-grid .price { font-weight: 700; color: var(--brand); }

/* Utilidades */
.text-muted { color: var(--text-secondary) !important; }
.shadow-sm { box-shadow: 0 6px 16px rgba(0,0,0,0.06) !important; }

/* Fullscreen Menu */
.fullscreen-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(31, 33, 40, 0.98); /* var(--card-bg) with high opacity */
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.fullscreen-menu.show {
    opacity: 1;
    visibility: visible;
    display: flex; /* Ensure flex is maintained */
}
.fullscreen-menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
.fullscreen-menu .nav-link {
    font-weight: 300;
    letter-spacing: 1px;
    color: var(--text);
    transition: color 0.2s, transform 0.2s;
}
.fullscreen-menu .nav-link:hover {
    color: var(--brand);
    transform: scale(1.1);
}
.fullscreen-menu button[data-bs-toggle="collapse"] {
    position: absolute;
    bottom: 50px;
    border-color: rgba(255,255,255,0.2);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: background 0.2s;
}
.fullscreen-menu button[data-bs-toggle="collapse"]:hover {
    background: rgba(255,255,255,0.1);
}

/* Admin layout */
.admin-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 0;
  transition: grid-template-columns .2s ease-in-out;
}
.admin-header .navbar { z-index: 1030; }
.admin-header .navbar .navbar-nav.ms-auto { margin-right: 15px; }
.admin-sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--card-border);
  border-radius: 0;
  padding: 1rem;
  transition: width .2s ease-in-out, padding .2s ease-in-out;
}
.admin-sidebar .sidebar-title {
  min-height: 32px;
}

/* Global Card & InfoBox overrides for Dark Theme */
.card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text);
  border-radius: 15px;
}
.card-header {
  background-color: rgba(255,255,255,0.05);
  border-bottom: 1px solid var(--card-border);
  border-radius: 15px 15px 0 0 !important;
}
.card-footer {
  background-color: rgba(255,255,255,0.05);
  border-top: 1px solid var(--card-border);
  border-radius: 0 0 15px 15px !important;
}
.card-title, .card-text, .card .text-muted, .h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--text) !important;
}
.card .text-muted {
  color: var(--text-secondary) !important;
}

/* Modern Login Styles */
.login-page {
    background: linear-gradient(135deg, var(--p-6), #1c2a48) !important;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px; /* Add padding to prevent sticking to edges */
}
.login-box {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}
.login-box .card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    overflow: hidden;
}
.login-box .card-header {
    background: transparent;
    border-bottom: 1px solid var(--card-border);
    padding: 1.5rem;
}
.login-box .card-body {
    padding: 2rem;
}
.login-logo a {
    color: white !important;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    display: block;
    margin-bottom: 1.5rem;
}
.login-logo img {
    max-height: 80px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}
/* Modern Inputs */
.login-box .input-group {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    border: 1px solid var(--card-border);
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
}
.login-box .input-group:focus-within {
    border-color: var(--p-1);
    box-shadow: 0 0 0 3px rgba(32, 194, 205, 0.15);
}
.login-box .form-control {
    background: transparent !important;
    border: none !important;
    color: white !important;
    padding: 0.75rem 1rem;
    height: auto;
    font-size: 1rem;
}
.login-box .form-control:focus {
    box-shadow: none;
}
.login-box .input-group-text {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding-right: 1rem;
}
/* Modern Button */
.login-box .btn-primary {
    background: linear-gradient(135deg, var(--p-1), var(--p-4));
    border: none;
    border-radius: 12px;
    padding: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(32, 194, 205, 0.25);
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}
.login-box .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(32, 194, 205, 0.35);
}
.login-box .icheck-primary label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.login-box a {
    color: var(--p-1);
    text-decoration: none;
    transition: color 0.2s;
}
.login-box a:hover {
    color: var(--p-2);
}

/* Info Box (Restored) */
.info-box {
  background-color: var(--card-bg);
  color: var(--text);
  border-radius: 15px;
  border: 1px solid var(--card-border);
  min-height: 100px;
  display: flex;
  margin-bottom: 1rem;
  padding: 0.5rem;
}
.info-box-icon {
  border-radius: 15px 0 0 15px; /* Match rounded corners */
}
.info-box-text, .info-box-number {
  color: var(--text);
}
.info-box-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Modal adjustments */
.modal-content {
  background-color: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--card-border);
}
.modal-header, .modal-footer {
  border-color: var(--card-border);
}
.btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

.pdf-preview-wrap {
  width: 100%;
}
.pdf-preview {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
  min-height: 140px;
  max-height: 340px;
}
.pdf-preview-canvas {
  display: block;
  width: 100%;
  height: auto;
}
.pdf-preview-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(31, 33, 40, 0) 45%, rgba(31, 33, 40, 1) 100%);
  pointer-events: none;
}
.pdf-preview-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  z-index: 2;
}
.pdf-preview.is-loaded .pdf-preview-status {
  display: none;
}
.pdf-preview.is-empty .pdf-preview-canvas {
  display: none;
}

/* Tables */
.table {
  color: var(--text);
  background-color: transparent;
}
.table th, .table td {
  border-color: var(--card-border);
}
.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text);
}
.table-hover > tbody > tr:hover > * {
  background-color: rgba(255, 255, 255, 0.075);
  color: var(--text);
}

/* Forms */
.form-control, .form-select {
  background-color: var(--bg);
  border-color: var(--card-border);
  color: var(--text);
}
.form-control:focus, .form-select:focus {
  background-color: var(--bg);
  color: var(--text);
  border-color: var(--brand);
  box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.25);
}
.form-control::placeholder {
  color: var(--text-secondary);
}
.form-control:disabled, .form-control[readonly] {
  background-color: rgba(255,255,255,0.05);
  opacity: 1;
}

.cart-item {
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: var(--card-bg);
}

.cart-item-title {
  line-height: 1.25;
}

.cart-item-meta {
  font-size: 0.95rem;
}

.cart-summary {
  border-top: 1px solid var(--card-border);
  padding-top: 12px;
}
