/* =========================
   Reset básico
   ========================= */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Tahoma, Arial, sans-serif;
  background-color: #f5f5f5;
  color: #333;
}

/* =========================
   Layout principal
   ========================= */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* =========================
   Sidebar
   ========================= */
.sidebar {
  width: 240px;
  background-color: #e0f0ff;
  min-height: 100vh;
  padding: 20px;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
}

.sidebar-title {
  margin: 0 0 20px 0;
  font-size: 22px;
  color: #333;
  text-align: center;
}

.menu-root {
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-item {
  margin-bottom: 4px;
}

.menu-item > a,
.menu-item > .menu-label {
  display: block;
  width: 100%;
  padding: 8px 12px;
  color: #333;
  text-decoration: none;
  border: none;
  border-radius: 4px;
  background: transparent;
  font-weight: bold;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  font-family: inherit;
  font-size: inherit;
}

.menu-item > a:hover,
.menu-item > .menu-label:hover {
  background-color: #b4dffa;
  color: #000;
}

.menu-item > a.active {
  background-color: #99cded;
  color: #000;
}

.menu-item.has-children > .submenu {
  list-style: none;
  margin: 4px 0 8px 0;
  padding: 0;
  display: none;
}

.menu-item.has-children.open > .submenu {
  display: block;
}

.menu-label.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-icon::before {
  content: '+';
  font-weight: bold;
}

.menu-item.has-children.open > .menu-label .toggle-icon::before {
  content: '−';
}

.menu-item.has-children.open > .menu-label {
  background-color: #b4dffa;
  color: #000;
}

.submenu li {
  margin: 2px 0 2px 12px;
}

.submenu li a {
  display: block;
  padding: 6px 10px;
  color: #222;
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.95em;
  transition: background-color 0.2s, color 0.2s;
}

.submenu li a:hover {
  background-color: #cde8f9;
  color: #000;
}

.submenu li a.active {
  background-color: #b0dffe;
  color: #000;
}

/* =========================
   Botón hamburguesa
   ========================= */
#menuToggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1001;
  font-size: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
}

/* =========================
   Contenido principal
   ========================= */
.main-content {
  flex: 1;
  padding: 20px;
}

.container {
  background-color: #ffffff;
  margin: 20px;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 0 5px rgba(0,0,0,0.05);
  border: 2px solid #000;
}

.page-title {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 26px;
  color: #222;
}

.page-subtitle {
  margin-top: 0;
  margin-bottom: 25px;
  color: #555;
  font-size: 14px;
}

/* =========================
   Cards / dashboard
   ========================= */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
}

.card {
  background: #f8fbff;
  border: 1px solid #cfe6f6;
  border-radius: 12px;
  padding: 18px;
}

.card h3 {
  margin: 0 0 8px 0;
  font-size: 15px;
  color: #333;
}

.card .big-number {
  font-size: 28px;
  font-weight: bold;
  color: #111;
}

/* =========================
   Botones
   ========================= */
.btn {
  display: inline-block;
  padding: 10px 14px;
  border: none;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
}

.btn-primary {
  background-color: #e0f0ff;
  color: #333;
}

.btn-primary:hover {
  background-color: #d0e8fa;
}

.btn-danger {
  background-color: #ffe0e0;
  color: #8a1f1f;
}

.btn-danger:hover {
  background-color: #ffd1d1;
}

/* =========================
   Formularios
   ========================= */
.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: bold;
  font-size: 14px;
}

.form-control {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  background-color: #f5f5f5;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* =========================
   Mensajes
   ========================= */
.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-danger {
  background: #ffe5e5;
  color: #8a1f1f;
  border: 1px solid #f3b1b1;
}

.alert-success {
  background: #e7f8ea;
  color: #216b2f;
  border: 1px solid #b8e3c1;
}

/* =========================
   Login
   ========================= */
.login-page {
  background-color: #f5f5f5;
}

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-box {
  background-color: #ffffff;
  padding: 30px 40px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  width: 360px;
  text-align: center;
  border: 3px solid #000;
}

.login-box h1 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 24px;
  color: #222;
}

.login-box p {
  margin-top: 0;
  margin-bottom: 20px;
  color: #666;
  font-size: 14px;
}

/* =========================
   Tablas
   ========================= */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  border: 1px solid #d8e5ef;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.data-table thead th {
  background-color: #eaf5fd;
  color: #222;
}

.data-table tbody tr:nth-child(even) {
  background-color: #fafcff;
}

/* =========================
   Estados
   ========================= */
.status-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
}

.status-pendiente {
  background: #fff5cc;
  color: #8a6d00;
}

.status-en_proceso {
  background: #dff1ff;
  color: #0b5f8a;
}

.status-enviado,
.status-completado,
.status-realizada {
  background: #e6f8e9;
  color: #1c6b33;
}

.status-cancelado {
  background: #ffe5e5;
  color: #912020;
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 992px) {
  .grid-cards {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 768px) {
  #menuToggle {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    width: 100%;
    padding: 10px;
  }

  .container {
    margin: 10px 0 0 0;
    padding: 22px 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .grid-cards {
    grid-template-columns: 1fr;
  }
}