/* === CSS UNIFICADO MOBILE FIRST === */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #ffffff;
  color: #1d558c;
  min-height: 100vh;
  overflow-x: hidden;
}

h1 {
  color: #1d558c;
}

p {
  color: #1d558c;
}

/* === ANIMATIONS === */

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* === LOADER === */

#loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid #1d558c;
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s ease-in-out infinite;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-spinner {
  border: 5px solid #f3f3f3;
  border-top: 5px solid #478BE5;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

#loader p {
  margin-top: 0.75em;
  color: #1d558c;
  font-size: 1em;
}

.loading-overlay p {
  color: #1d558c;
  font-size: 1em;
}

/* === MENU HAMBURGUESA === */

.menu-toggle {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1000;
  background: #1d558c;
  color: white;
  border: none;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  transition: all 0.3s ease;
  justify-content: center;
  align-items: center;
}

.menu-toggle:hover {
  background: #183f3b;
}

.menu-toggle.active {
  transform: translateX(220px);
}

.menu-toggle i {
  font-size: 1.2em;
}

/* === SIDEBAR === */

.sidebar {
  width: 260px;
  background: #1d558c;
  padding: 2em 1.5em;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  position: fixed;
  height: 100vh;
  z-index: 999;
  overflow-y: auto;
}

.sidebar.hidden {
  transform: translateX(-100%);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar .logo {
  font-size: 1.8em;
  font-weight: bold;
  margin-bottom: 3em;
  display: flex;
  align-items: center;
  color: #ffffff;
}

.sidebar .logo .star {
  font-size: 1.4em;
  margin-left: 0.5em;
}

.sidebar nav ul {
  list-style: none;
  padding: 0;
}

.sidebar nav ul li {
  margin-bottom: 2em;
  position: relative;
}

.sidebar nav ul li a {
  text-decoration: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  font-size: 1em;
  padding: 0.5em 0;
  transition: color 0.2s ease;
}

.sidebar nav ul li a:hover {
  color: #a8d5d0;
}

.sidebar nav ul li a i {
  margin-right: 0.75em;
  font-size: 1.4em;
  min-width: 24px;
}

.sidebar nav ul li.has-sub > a {
  justify-content: space-between;
  cursor: pointer;
}

.sidebar nav ul li .sub-menu {
  list-style: none;
  padding-left: 2.5em;
  margin-top: 1em;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding-top 0.3s ease;
}

.sidebar nav ul li.has-sub.active .sub-menu {
  max-height: 200px;
  padding-top: 0.5em;
}

.sidebar nav ul li .sub-menu li {
  margin-bottom: 1.5em;
}

.sidebar nav ul li .sub-menu li a {
  font-size: 0.95em;
  color: #ffffff;
  padding: 0.3em 0;
}

.sidebar nav ul li .sub-menu li a:hover {
  color: #a8d5d0;
}

.sidebar nav ul li .chevron {
  transition: transform 0.3s ease;
}

.sidebar nav ul li.has-sub.active .chevron {
  transform: rotate(180deg);
}

/* === ÁREA DE CONTENIDO === */

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  margin-left: 260px;
  transition: margin-left 0.3s ease;
  min-height: 100vh;
}

.content.full-width {
  margin-left: 0;
}

/* === HEADER === */

header {
  padding: 1em 1.5em;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header .back-btn {
  text-decoration: none;
  font-size: 1.8em;
  font-weight: 700;
  color: #478BE5;
  margin-right: 1em;
}

header .mobile-title {
  display: none;
  font-size: 1.4em;
  color: #222;
  margin-left: 0.5em;
  flex: 1;
  text-align: center;
}

header .supply {
  flex: 1;
  font-size: 1em;
  color: #555;
}

header .office-btn {
  text-decoration: none;
  background: #478BE5;
  color: #fff;
  padding: 0.5em 1em;
  border-radius: 4px;
  transition: background 0.2s ease;
}

header .office-btn:hover {
  background: #007D63;
}

/* === MAIN CONTENT === */

main {
  flex: 1;
  padding: 2em;
}

/* === CARDS Y FORMULARIOS === */

.card {
  background: #ffffff;
  padding: 2em;
  border-radius: 8px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
  max-width: 400px;
  width: 100%;
  text-align: center;
  margin: 0 auto;
}

.payment-card,
.payment-result {
  background: #fff;
  padding: 2em;
  border-radius: 8px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
  max-width: 500px;
  width: 100%;
  margin: 0 auto;
}

.payment-card h1,
.payment-result h2 {
  text-align: center;
  margin-bottom: 1.5em;
  color: #1d558c;
}

.card h1 {
  color: #1d558c;
}

.card .lead {
  color: #555;
}

.icon {
  font-size: 3em;
  color: #1d558c;
  margin-bottom: 0.5em;
}

.result-icon {
  text-align: center;
  font-size: 3em;
  margin-bottom: 20px;
}

.result-icon.success {
  color: #478BE5;
}

.result-icon.error {
  color: #e74c3c;
}

.result-box {
  max-width: 420px;
  margin: auto;
  background: #fff;
  border-radius: 12px;
  padding: 1.4em;
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
}

.result-header {
  text-align: center;
  margin-bottom: 1em;
  color: #222;
}

.result-header i {
  font-size: 2.5em;
  color: #1d558c;
}

.result-header h2 {
  margin: .4em 0;
  color: #1d558c;
}

.result-header small {
  color: #666;
}

/* === TIPOS DE TARJETA === */

.card-types {
  display: flex;
  gap: 0.5em;
  margin-bottom: 1.5em;
}

.card-type {
  flex: 1;
  text-align: center;
  padding: 1em;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  color: #333;
}

.card-type.selected {
  border-color: #478BE5;
  background: rgba(0, 152, 121, 0.1);
}

.card-type i {
  font-size: 1.5em;
  margin-bottom: 0.5em;
  color: #333;
}

.card-type p {
  color: #333;
  margin: 0;
}

/* === FORMULARIOS === */

form {
  text-align: left;
}

.form-group {
  margin-bottom: 1.5em;
}

.form-group label {
  display: block;
  margin-bottom: 0.5em;
  font-weight: 600;
  color: #1d558c;
}

.form-group input,
.form-group select,
input[type="text"],
input[type="email"],
input[type="tel"] {
  width: 100%;
  padding: 0.75em;
  border: 1px solid #ddd;
  border-radius: 4px;
  transition: border-color 0.2s;
  font-size: 1em;
  color: #333;
}

.form-group input:focus,
.form-group select:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus {
  border-color: #1d558c;
  outline: none;
}

.invalid {
  border-color: #e74c3c !important;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.error-message {
  color: #e74c3c;
  text-align: center;
  margin: 20px 0;
  font-weight: bold;
}

/* === BOTONES === */

button,
.btn-pay,
.btn-retry,
.btn-main {
  width: 100%;
  padding: 0.9em;
  background: #1d558c;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s ease;
  font-weight: 600;
}

button:hover,
.btn-pay:hover,
.btn-retry:hover,
.btn-main:hover {
  background: #183f3b;
}

.btn-pay,
.btn-retry,
.btn-main {
  background: #478BE5;
  padding: 0.75em;
  margin-top: 0.5em;
}

.btn-pay:hover,
.btn-retry:hover,
.btn-main:hover {
  background: #007D63;
}

input[type="submit"] {
  width: 100%;
  padding: 0.9em;
  background: #1d558c;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s ease;
  font-weight: 600;
}

input[type="submit"]:hover {
  background: #183f3b;
}

.btn-next-fixed {
  display: none;
}

.btn-next-mobile {
  display: none;
}

/* === INFO ROWS === */

.info-row {
  display: flex;
  justify-content: space-between;
  padding: .6em 0;
  border-bottom: 1px solid #eee;
  font-size: .95em;
  color: #333;
}

.info-row:last-child {
  border-bottom: none;
}

.info-row .label {
  font-weight: 600;
  color: #555;
}

.info-row .value {
  color: #333;
}

.amount {
  background: linear-gradient(135deg,#1d558c,#007d63);
  color: #fff;
  border-radius: 10px;
  padding: 1em;
  text-align: center;
  margin: 1.2em 0;
}

.amount .value {
  font-size: 1.8em;
  font-weight: 800;
  margin-top: .2em;
}

.amount-display {
  margin-top: 1em;
  text-align: center;
  font-size: 1.1em;
  font-weight: bold;
  color: #478BE5;
}

/* === STEPS Y PANELES === */

.step h2 {
  font-size: 0.8em;
  color: #999;
  letter-spacing: 1px;
}

.step h1 {
  font-size: 1.6em;
  margin-bottom: 1em;
  color: #1d558c;
}

.total-panel {
  background: #fff;
  padding: 0.8em 1em;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1em;
}

.total-panel .label {
  font-weight: 600;
  color: #555;
}

.total-panel .amount {
  font-size: 1.2em;
  color: #478BE5;
  font-weight: 700;
}

/* === TABLAS === */

.table-container {
  background: #fff;
  padding: 1em;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 1em;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5em;
}

.summary-table tr:not(:last-child) {
  border-bottom: 1px solid #eee;
}

.summary-table td {
  padding: 12px 0;
  color: #333;
}

.summary-table td:first-child {
  font-weight: bold;
  width: 40%;
  color: #555;
}

thead th {
  text-align: left;
  padding: 0.75em;
  background: #fafafa;
  border-bottom: 1px solid #eee;
  color: #555;
}

tbody tr {
  border-bottom: 1px solid #eee;
  transition: background-color 0.3s ease;
}

tbody tr.selected {
  background-color: rgba(0, 152, 121, 0.1);
}

td {
  padding: 0.75em;
  vertical-align: middle;
  color: #333;
}

/* === STATUS Y ESTADOS === */

.status {
  padding: 0.3em 0.6em;
  border-radius: 4px;
  font-size: 0.9em;
  font-weight: 600;
}

.status.vencida,
.status.adeudada {
  background: #fdecea;
  color: #b32020;
}

.status.pagada {
  background: #e6f7ef;
  color: #478BE5;
}

/* === CARDS MÓVILES === */

.cards {
  display: none;
}

.card-item {
  background: #fff;
  margin: 0 auto 1.5em;
  padding: 1.5em;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  position: relative;
  width: calc(100% - 2em);
}

.card-item input[type="checkbox"] {
  position: absolute;
  top: 1em;
  right: 1em;
  transform: scale(1.4);
}

.card-item.selected {
  border-top: 4px solid #478BE5;
}

.field {
  display: flex;
  justify-content: space-between;
  padding: 0.75em 0;
  border-bottom: 1px solid #eee;
}

.field:last-child {
  border-bottom: none;
}

.field .label {
  font-size: 1em;
  font-weight: 700;
  color: #555;
}

.field .value {
  font-size: 1em;
  font-weight: 500;
  color: #333;
}

.card-item .status {
  position: static;
  margin: 0;
  float: right;
}

/* === FOOTER === */

footer {
  background: #ffffff;
  padding: 1.5em;
  text-align: center;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  margin-top: auto;
}

.social {
  margin-bottom: 1em;
}

.social a {
  margin: 0 0.5em;
  color: #1d558c;
  font-size: 1.2em;
  transition: color 0.2s ease;
  text-decoration: none;
}

.social a:hover {
  color: #478BE5;
}

.legal {
  margin-top: 1em;
  font-size: 0.8em;
  color: #666;
}

.legal a {
  color: #1d558c;
  text-decoration: none;
}

.legal a:hover {
  text-decoration: underline;
}

/* === RESPONSIVE DESIGN === */

@media (min-width: 769px) {
  .sidebar {
    display: block;
  }

  .content {
    margin-left: 260px;
  }

  .total-panel {
    width: 60%;
    margin: 0 auto 1em;
  }

  .btn-next-fixed {
    display: block;
    position: fixed;
    bottom: 1em;
    right: 1em;
    background: #478BE5;
    color: #fff;
    padding: 0.8em 1.5em;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: pointer;
    width: auto;
  }

  .btn-next-fixed:hover {
    background: #007D63;
  }
}

@media (max-width: 992px) {
  .sidebar {
    width: 240px;
    padding: 1.5em 1em;
  }

  .content {
    margin-left: 240px;
  }
}

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }

  .sidebar {
    width: 260px;
    transform: translateX(-100%);
    position: absolute;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .content {
    margin-left: 0;
  }

  .content.full-width {
    margin-left: 0;
  }

  header {
    text-align: center;
  }

  header .mobile-title {
    display: inline-block;
  }

  header .supply,
  header .office-btn {
    display: none;
  }

  table {
    display: none;
  }

  .cards {
    display: block;
    margin-bottom: 4em;
  }

  .btn-next-mobile {
    display: block;
    position: fixed;
    bottom: 1em;
    left: 50%;
    transform: translateX(-50%);
    background: #478BE5;
    color: #fff;
    padding: 0.8em 1.5em;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    width: calc(100% - 2em);
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 100;
  }

  .btn-next-mobile:hover {
    background: #007D63;
  }

  main {
    padding: 1em;
  }

  .card {
    padding: 1.5em;
  }

  footer {
    padding: 1em;
  }

  .menu-toggle {
    top: 10px;
    left: 10px;
  }
}
