/* =============================================
   e-multimedia_front — Material Design 3 Theme
   Plantilla 100% propia — Linktics Solutions
   ============================================= */

/* =========================================
   1. TOKENS (CSS Custom Properties / MD3)
   ========================================= */
:root {
  --md-primary: #006874;
  --md-on-primary: #ffffff;
  --md-primary-container: #97f0ff;
  --md-on-primary-container: #001f24;
  --md-secondary: #4a6267;
  --md-on-secondary: #ffffff;
  --md-secondary-container: #cde7ec;
  --md-on-secondary-container: #051f23;
  --md-tertiary: #525e7d;
  --md-on-tertiary: #ffffff;
  --md-tertiary-container: #dae2ff;
  --md-error: #ba1a1a;
  --md-on-error: #ffffff;
  --md-error-container: #ffdad6;
  --md-background: #f4fafb;
  --md-on-background: #161d1e;
  --md-surface: #ffffff;
  --md-on-surface: #161d1e;
  --md-surface-variant: #dbe4e6;
  --md-on-surface-variant: #3f484a;
  --md-surface-1: #eaf4f6;
  --md-outline: #6f797a;
  --md-outline-variant: #bfc8ca;
  --md-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  --md-shadow-2: 0 2px 6px rgba(0, 0, 0, 0.14), 0 1px 4px rgba(0, 0, 0, 0.1);
  --md-shadow-3: 0 4px 12px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.12);
  --md-shadow-4: 0 8px 24px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.14);
  --md-radius-xs: 4px;
  --md-radius-sm: 8px;
  --md-radius-md: 12px;
  --md-radius-lg: 16px;
  --md-radius-xl: 28px;
  --md-radius-full: 50px;
  --md-font: "Roboto", sans-serif;
  --md-transition: all 0.22s cubic-bezier(0.2, 0, 0, 1);
  --md-transition-slow: all 0.35s cubic-bezier(0.2, 0, 0, 1);
  --sidebar-width: 265px;
  --navbar-height: 64px;
}

/* =========================================
   2. RESET & BASE
   ========================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
  scroll-behavior: smooth;
}
/* Evita el scroll horizontal a nivel de documento: cualquier elemento más
   ancho que el viewport (tablas, contenido) queda contenido y la vista no se
   desplaza/recorta. Los contenedores con scroll propio (.md-table-card) no se
   afectan porque su overflow es interno. */
html,
body {
  overflow-x: hidden;
  max-width: 100%;
}
body {
  font-family: var(--md-font);
  background-color: var(--md-background);
  color: var(--md-on-background);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a {
  text-decoration: none;
  color: var(--md-primary);
}
ul {
  list-style: none;
}
button {
  font-family: var(--md-font);
  cursor: pointer;
}
select,
input {
  font-family: var(--md-font);
}

/* =========================================
   3. NAVBAR
   ========================================= */
.md-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  height: var(--navbar-height);
  max-width: 100%;
  background: linear-gradient(90deg, var(--md-primary) 0%, #007d8c 100%);
  color: var(--md-on-primary);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0, 104, 116, 0.4);
}

.md-navbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--md-on-primary);
  min-width: var(--sidebar-width);
  padding-left: 8px;
}

/* El botón hamburguesa nunca debe encogerse ni desaparecer en pantallas chicas */
.md-sidebar-toggle {
  flex-shrink: 0;
}

.md-navbar__brand img {
  height: 40px;
  object-fit: contain;
  filter: none;
  border-radius: 8px;
}

.md-navbar__brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.md-navbar__spacer {
  flex: 1;
}

.md-navbar__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.md-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--md-on-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: var(--md-transition);
  position: relative;
  overflow: hidden;
}
.md-icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* User chip */
.md-user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px 5px 6px;
  border-radius: var(--md-radius-full);
  cursor: pointer;
  transition: var(--md-transition);
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: var(--md-on-primary);
  font-size: 14px;
  font-weight: 500;
}
.md-user-chip:hover {
  background: rgba(255, 255, 255, 0.25);
}

.md-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

/* Dropdown */
.md-user-menu {
  position: relative;
}
.md-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: var(--md-surface);
  border-radius: var(--md-radius-md);
  box-shadow: var(--md-shadow-4);
  min-width: 210px;
  overflow: hidden;
  display: none;
  z-index: 2000;
}
.md-dropdown-menu.open {
  display: block;
  animation: dropIn 0.2s cubic-bezier(0.2, 0, 0, 1);
}
@keyframes dropIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.md-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--md-transition);
  color: var(--md-on-surface);
  font-size: 14px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.md-dropdown-item:hover {
  background: var(--md-surface-variant);
}
.md-dropdown-item i {
  font-size: 18px;
  color: var(--md-on-surface-variant);
}
.md-dropdown-divider {
  height: 1px;
  background: var(--md-outline-variant);
  margin: 4px 0;
}

/* =========================================
   4. BODY LAYOUT
   ========================================= */
.app-body {
  display: flex;
  margin-top: var(--navbar-height);
  min-height: calc(100vh - var(--navbar-height));
}

/* =========================================
   5. SIDEBAR
   ========================================= */
.md-sidebar {
  position: fixed;
  left: 0;
  top: var(--navbar-height);
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--md-surface);
  border-right: 1px solid var(--md-outline-variant);
  overflow-y: auto;
  overflow-x: hidden;
  transition:
    width var(--md-transition-slow),
    transform var(--md-transition-slow);
  z-index: 1000;
  display: flex;
  flex-direction: column;
}
.md-sidebar.collapsed {
  width: 72px;
}
/* Ocultar elementos en versión colapsada */
.md-sidebar.collapsed .sidebar-profile__name,
.md-sidebar.collapsed .sidebar-profile__select {
  display: none !important;
}
.md-sidebar.collapsed .sidebar-profile {
  padding: 16px 8px;
}
.md-sidebar.collapsed .sidebar-avatar {
  width: 44px;
  height: 44px;
  font-size: 16px;
}
.md-sidebar.collapsed .md-nav-group-header .menu-title,
.md-sidebar.collapsed .md-nav-group-header .menu-arrow {
  display: none !important;
}
.md-sidebar.collapsed .md-nav-group-header {
  padding: 14px 0;
  justify-content: center;
}
.md-sidebar.collapsed .md-nav-group-header i.menu-icon {
  margin: 0;
  font-size: 22px;
}
.md-sidebar.collapsed .collapse {
  display: none !important; /* Force hide submenus */
}
.md-sidebar::-webkit-scrollbar {
  width: 4px;
}
.md-sidebar::-webkit-scrollbar-thumb {
  background: var(--md-outline-variant);
  border-radius: 4px;
}

/* Profile block */
.sidebar-profile {
  padding: 24px 16px 28px;
  background: linear-gradient(
    145deg,
    var(--md-primary-container),
    var(--md-secondary-container)
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--md-outline-variant);
  text-align: center;
}
.sidebar-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--md-primary);
  color: var(--md-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  box-shadow: var(--md-shadow-2);
  flex-shrink: 0;
}
.sidebar-profile__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--md-on-primary-container);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.sidebar-select-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.sidebar-select-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--md-on-primary-container);
  opacity: 0.75;
  margin-bottom: 5px;
  padding-left: 6px;
  text-align: left;
  user-select: none;
}
.sidebar-profile__select {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid rgba(0, 104, 116, 0.4);
  border-radius: var(--md-radius-sm);
  background: rgba(255, 255, 255, 0.85);
  color: var(--md-on-surface);
  font-size: 12px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23006874' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
  transition: var(--md-transition);
}
.sidebar-profile__select:focus {
  border-color: var(--md-primary);
  box-shadow: 0 0 0 2px rgba(0, 104, 116, 0.2);
}

/* Nav tree */
.md-nav {
  padding: 8px 0;
  flex: 1;
}

.md-nav-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  cursor: pointer;
  border-radius: var(--md-radius-sm);
  margin: 2px 8px;
  transition: var(--md-transition);
  color: var(--md-on-surface-variant);
  font-size: 14px;
  font-weight: 500;
  user-select: none;
  border: none;
  background: transparent;
  width: calc(100% - 16px);
  text-align: left;
  position: relative;
  font-family: inherit;
}
.md-nav-group-header:hover {
  background: var(--md-surface-variant);
  color: var(--md-on-surface);
}
.md-nav-group-header.active {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  font-weight: 600;
}
.md-nav-group-header i.menu-icon {
  font-size: 20px;
  flex-shrink: 0;
  color: var(--md-primary);
  width: 24px;
}
.md-nav-group-header .menu-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.md-nav-group-header .menu-arrow {
  font-size: 18px;
  transition: transform 0.2s ease;
  color: var(--md-on-surface-variant);
}
.md-nav-group-header[aria-expanded="true"] .menu-arrow {
  transform: rotate(90deg);
}
.md-nav-group-header .menu-arrow::before {
  content: "\F035F";
  font-family: "Material Design Icons";
  font-style: normal;
}

/* Comportamiento Acordeón JS Customs */
.collapse {
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.collapse.show {
  display: block;
  opacity: 1;
  animation: slideDown 0.3s ease-out forwards;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.md-sub-menu {
  padding: 4px 0 8px 0;
  list-style: none; /* Elimina bullets list */
  margin: 0;
  position: relative;
}
/* Linea vertical indentada */
.md-sub-menu::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 12px;
  left: 28px;
  width: 1.5px;
  background: var(--md-outline-variant);
  opacity: 0.6;
}

.md-sub-menu li {
  margin: 0;
  padding: 0;
}

.md-sub-menu li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px 9px 48px;
  border-radius: 0 var(--md-radius-full) var(--md-radius-full) 0;
  margin: 2px 12px 2px 0;
  color: var(--md-on-surface-variant);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.25s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  text-decoration: none;
}
.md-sub-menu li a:hover {
  background: var(--md-surface-variant);
  color: var(--md-on-surface);
  transform: translateX(4px);
}
.md-sub-menu li a.active {
  background: rgba(0, 104, 116, 0.08); /* tono pastel primary */
  color: var(--md-primary);
  font-weight: 600;
}
/* Linea horizontal hacia el item */
.md-sub-menu li a::before {
  content: "";
  position: absolute;
  left: 28px;
  top: 50%;
  width: 12px;
  height: 1.5px;
  border-radius: 0;
  background: var(--md-outline-variant);
  opacity: 0.6;
}
.md-sub-menu li a:hover::before,
.md-sub-menu li a.active::before {
  opacity: 1;
  background: var(--md-primary);
}

/* =========================================
   6. MAIN PANEL
   ========================================= */
.md-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  /* min-width:0 permite que el panel se encoja al ancho disponible; sin esto,
     un hijo ancho (tabla/texto) lo expande más allá del viewport y desplaza la
     vista horizontalmente en móvil. */
  min-width: 0;
  transition: margin-left var(--md-transition-slow);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--navbar-height));
}
.md-main.expanded {
  margin-left: 68px;
}
.md-content {
  flex: 1;
  padding: 28px;
  background: var(--md-background);
}

/* =========================================
   7. CARDS
   ========================================= */
.md-card {
  background: var(--md-surface);
  border-radius: var(--md-radius-md);
  box-shadow: var(--md-shadow-1);
  overflow: hidden;
  transition: var(--md-transition);
}
.md-card:hover {
  box-shadow: var(--md-shadow-2);
}
.md-card__header {
  padding: 18px 20px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.md-card__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--md-on-surface);
}
.md-card__subtitle {
  font-size: 13px;
  color: var(--md-on-surface-variant);
  margin-top: 3px;
}
.md-card__body {
  padding: 16px 20px 20px;
}

/* Stat Cards */
.md-stat-card {
  background: var(--md-surface);
  border-radius: var(--md-radius-md);
  padding: 20px;
  box-shadow: var(--md-shadow-1);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--md-transition);
  border-left: 4px solid var(--md-primary);
  position: relative;
  overflow: hidden;
}
.md-stat-card::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--md-primary-container);
  opacity: 0.3;
}
.md-stat-card:hover {
  box-shadow: var(--md-shadow-3);
  transform: translateY(-2px);
}
.md-stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--md-radius-md);
  background: var(--md-primary-container);
  color: var(--md-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.md-stat-content {
  flex: 1;
  position: relative;
  z-index: 1;
}
.md-stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--md-on-surface);
  line-height: 1;
}
.md-stat-label {
  font-size: 13px;
  color: var(--md-on-surface-variant);
  margin-top: 4px;
}

/* Stat card color variants */
.md-stat-card--secondary {
  border-left-color: var(--md-secondary);
}
.md-stat-card--secondary .md-stat-icon {
  background: var(--md-secondary-container);
  color: var(--md-secondary);
}
.md-stat-card--secondary::after {
  background: var(--md-secondary-container);
}
.md-stat-card--tertiary {
  border-left-color: var(--md-tertiary);
}
.md-stat-card--tertiary .md-stat-icon {
  background: var(--md-tertiary-container);
  color: var(--md-tertiary);
}

/* =========================================
   8. BUTTONS
   ========================================= */
.md-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--md-radius-full);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1px;
  cursor: pointer;
  border: none;
  outline: none;
  transition: var(--md-transition);
  position: relative;
  overflow: hidden;
  user-select: none;
  white-space: nowrap;
}
.md-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.md-btn--filled {
  background: var(--md-primary);
  color: var(--md-on-primary);
  box-shadow: var(--md-shadow-1);
}
.md-btn--filled:hover {
  box-shadow: var(--md-shadow-2);
  filter: brightness(1.08);
}
.md-btn--filled:active {
  transform: scale(0.97);
}

.md-btn--tonal {
  background: var(--md-secondary-container);
  color: var(--md-on-secondary-container);
}
.md-btn--tonal:hover {
  box-shadow: var(--md-shadow-1);
}

.md-btn--outlined {
  background: transparent;
  color: var(--md-primary);
  border: 1.5px solid var(--md-outline);
}
.md-btn--outlined:hover {
  background: rgba(0, 104, 116, 0.08);
  border-color: var(--md-primary);
}

.md-btn--text {
  background: transparent;
  color: var(--md-primary);
  padding: 10px 12px;
}
.md-btn--text:hover {
  background: rgba(0, 104, 116, 0.08);
}

.md-btn--danger {
  background: var(--md-error);
  color: var(--md-on-error);
  box-shadow: var(--md-shadow-1);
}
.md-btn--danger:hover {
  box-shadow: var(--md-shadow-2);
  filter: brightness(1.08);
}

.md-btn--sm {
  padding: 7px 16px;
  font-size: 13px;
}
.md-btn--icon {
  padding: 10px;
  border-radius: 50%;
  min-width: 40px;
  height: 40px;
}

/* =========================================
   9. FORM INPUTS
   ========================================= */
.md-field {
  position: relative;
  margin-bottom: 18px;
}
.md-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--md-on-surface-variant);
  margin-bottom: 5px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.md-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--md-outline);
  border-radius: var(--md-radius-sm);
  background: var(--md-surface);
  color: var(--md-on-surface);
  font-size: 14px;
  transition: var(--md-transition);
  outline: none;
  appearance: none;
}
.md-input:focus {
  border-color: var(--md-primary);
  box-shadow: 0 0 0 3px rgba(0, 104, 116, 0.15);
}
.md-input:hover:not(:focus) {
  border-color: var(--md-on-surface);
}
.md-input::placeholder {
  color: var(--md-on-surface-variant);
  opacity: 0.7;
}
.md-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%233f484a' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
  cursor: pointer;
}
.md-input-icon-wrap {
  position: relative;
}
.md-input-icon-wrap .md-input {
  padding-left: 42px;
}
.md-input-icon-wrap .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--md-on-surface-variant);
  font-size: 18px;
  pointer-events: none;
}

/* =========================================
   10. DATATABLES OVERRIDE
   ========================================= */
.md-table-card {
  background: var(--md-surface);
  border-radius: var(--md-radius-md);
  box-shadow: var(--md-shadow-1);
  overflow: hidden;
}
table.dataTable {
  border-collapse: collapse;
  width: 100% !important;
  font-size: 14px;
}
table.dataTable thead th {
  background: var(--md-primary);
  color: var(--md-on-primary);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.6px;
  padding: 14px 16px;
  border: none;
  text-transform: uppercase;
  white-space: nowrap;
}
table.dataTable thead th.sorting::before,
table.dataTable thead th.sorting::after,
table.dataTable thead th.sorting_asc::after,
table.dataTable thead th.sorting_desc::after {
  opacity: 0.7;
}
table.dataTable tbody tr {
  border-bottom: 1px solid var(--md-outline-variant);
  transition: background 0.15s;
}
table.dataTable tbody tr:last-child {
  border-bottom: none;
}
table.dataTable tbody tr:hover {
  background: var(--md-surface-1) !important;
}
table.dataTable tbody td {
  padding: 12px 16px;
  border: none;
  vertical-align: middle;
}
table.dataTable input[type="radio"] {
  accent-color: var(--md-primary);
  cursor: pointer;
}

.dataTables_wrapper {
  padding: 0;
}
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length {
  padding: 16px 16px 0;
}
.dataTables_wrapper .dataTables_info {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--md-on-surface-variant);
}
.dataTables_wrapper .dataTables_paginate {
  padding: 8px 16px 16px;
}

.dataTables_wrapper .dataTables_filter input {
  border: 1.5px solid var(--md-outline);
  border-radius: var(--md-radius-sm);
  padding: 7px 12px;
  font-size: 13px;
  outline: none;
  margin-left: 8px;
  transition: var(--md-transition);
}
.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--md-primary);
  box-shadow: 0 0 0 3px rgba(0, 104, 116, 0.12);
}
.dataTables_wrapper .dataTables_length select {
  border: 1.5px solid var(--md-outline);
  border-radius: var(--md-radius-sm);
  padding: 6px 28px 6px 10px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  margin: 0 6px;
  appearance: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%233f484a' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E")
    no-repeat right 8px center;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--md-radius-sm) !important;
  padding: 5px 11px !important;
  font-size: 13px;
  color: var(--md-primary) !important;
  border: none !important;
  background: transparent !important;
  cursor: pointer;
  transition: var(--md-transition);
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: rgba(0, 104, 116, 0.1) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--md-primary) !important;
  color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  opacity: 0.38;
}

.tbl-action-icon {
  cursor: pointer;
  color: var(--md-primary);
  font-size: 18px;
  transition: var(--md-transition);
  display: inline-flex;
  align-items: center;
  padding: 5px;
  border-radius: 50%;
}
.tbl-action-icon:hover {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
}

/* =========================================
   11. MODAL (MD3 Dialog via Bootstrap)
   ========================================= */
.modal-content {
  border: none;
  border-radius: var(--md-radius-lg);
  box-shadow: var(--md-shadow-4);
  background: var(--md-surface);
  font-family: var(--md-font);
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--md-outline-variant);
  background: linear-gradient(135deg, var(--md-primary) 0%, #007d8c 100%);
  border-radius: var(--md-radius-lg) var(--md-radius-lg) 0 0;
}
.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--md-on-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-header .btn-close {
  filter: brightness(0) invert(1);
}
.modal-body {
  padding: 24px;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--md-outline-variant);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* =========================================
   12. BADGE / STATUS
   ========================================= */
.md-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--md-radius-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.md-badge--success {
  background: #d4edda;
  color: #1a6331;
}
.md-badge--danger {
  background: var(--md-error-container);
  color: var(--md-error);
}
.md-badge--warning {
  background: #fff3cd;
  color: #914d00;
}
.md-badge--info {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
}

/* =========================================
   13. DASHBOARD
   ========================================= */
.dashboard-header {
  margin-bottom: 24px;
}
.dashboard-header h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--md-on-surface);
}
.dashboard-header p {
  font-size: 14px;
  color: var(--md-on-surface-variant);
  margin-top: 4px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

/* =========================================
   14. FOOTER
   ========================================= */
.md-footer {
  background: var(--md-surface);
  border-top: 1px solid var(--md-outline-variant);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--md-on-surface-variant);
  flex-wrap: wrap;
  gap: 6px;
}
.md-footer a {
  color: var(--md-primary);
}

/* =========================================
   15. LOGIN PAGE
   ========================================= */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  background: var(--md-surface);
}
.login-form-card {
  width: 100%;
  max-width: 420px;
}
.login-logo {
  text-align: center;
  margin-bottom: 36px;
}
.login-logo img {
  height: 54px;
  object-fit: contain;
}
.login-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--md-on-surface);
  margin-bottom: 8px;
  text-align: center;
  letter-spacing: -0.5px;
}
.login-subtitle {
  font-size: 14px;
  color: var(--md-on-surface-variant);
  text-align: center;
  margin-bottom: 32px;
}

.login-visual-panel {
  background: linear-gradient(155deg, #006874 0%, #004d59 45%, #002026 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}
.login-visual-panel::before {
  content: "";
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: rgba(151, 240, 255, 0.08);
  top: -150px;
  right: -150px;
}
.login-visual-panel::after {
  content: "";
  position: absolute;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  background: rgba(151, 240, 255, 0.06);
  bottom: -100px;
  left: -80px;
}
.login-visual-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: rgba(255, 255, 255, 0.95);
}
.login-visual-icon {
  font-size: 88px;
  margin-bottom: 28px;
  opacity: 0.9;
}
.login-visual-title {
  font-size: 34px;
  font-weight: 700;
  margin-bottom: 14px;
  line-height: 1.2;
}
.login-visual-subtitle {
  font-size: 16px;
  opacity: 0.78;
  line-height: 1.7;
  max-width: 340px;
}
.login-visual-copyright {
  position: absolute;
  bottom: 24px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
}

/* Features list en login */
.login-features {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  opacity: 0.85;
}
.login-feature-item i {
  font-size: 20px;
  opacity: 0.9;
}

/* =========================================
   16. MODULE LAYOUT
   ========================================= */
.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--md-outline-variant);
  flex-wrap: wrap;
  gap: 12px;
}
.module-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--md-on-surface);
  display: flex;
  align-items: center;
  gap: 10px;
}
.module-title i {
  font-size: 22px;
  color: var(--md-primary);
}
.module-description {
  font-size: 13px;
  color: var(--md-on-surface-variant);
  margin-top: 3px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

/* =========================================
   17. UTILITIES
   ========================================= */
.d-flex {
  display: flex;
}
.d-grid {
  display: grid;
}
.align-items-center {
  align-items: center;
}
.justify-content-between {
  justify-content: space-between;
}
.justify-content-end {
  justify-content: flex-end;
}
.flex-wrap {
  flex-wrap: wrap;
}
.gap-1 {
  gap: 4px;
}
.gap-2 {
  gap: 8px;
}
.gap-3 {
  gap: 12px;
}
.gap-4 {
  gap: 16px;
}
.mb-0 {
  margin-bottom: 0;
}
.mb-1 {
  margin-bottom: 4px;
}
.mb-2 {
  margin-bottom: 8px;
}
.mb-3 {
  margin-bottom: 12px;
}
.mb-4 {
  margin-bottom: 16px;
}
.mb-5 {
  margin-bottom: 24px;
}
.mt-1 {
  margin-top: 4px;
}
.mt-2 {
  margin-top: 8px;
}
.mt-3 {
  margin-top: 12px;
}
.mt-4 {
  margin-top: 16px;
}
.mt-5 {
  margin-top: 24px;
}
.mr-2 {
  margin-right: 8px;
}
.ml-2 {
  margin-left: 8px;
}
.w-100 {
  width: 100%;
}
.text-center {
  text-align: center;
}
.text-muted {
  color: var(--md-on-surface-variant);
}
.text-primary {
  color: var(--md-primary);
}
.text-error {
  color: var(--md-error);
}
.fw-500 {
  font-weight: 500;
}
.fw-600 {
  font-weight: 600;
}
.fw-700 {
  font-weight: 700;
}
.text-sm {
  font-size: 13px;
}
.text-xs {
  font-size: 12px;
}
.divider {
  height: 1px;
  background: var(--md-outline-variant);
  margin: 16px 0;
}

/* Spinner */
.md-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0, 104, 116, 0.2);
  border-top-color: var(--md-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* =========================================
   18. RESPONSIVE
   ========================================= */
@media (max-width: 1024px) {
  .login-shell {
    grid-template-columns: 1fr;
  }
  .login-visual-panel {
    display: none;
  }
  .login-form-panel {
    min-height: 100vh;
  }
}
@media (max-width: 768px) {
  :root {
    --sidebar-width: 265px;
  }
  .md-sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
    box-shadow: var(--md-shadow-4);
  }
  .md-sidebar.mobile-open {
    transform: translateX(0);
  }
  .md-main {
    margin-left: 0;
  }
  /* En móvil el brand no debe reservar el ancho del sidebar (265px), porque
     comprime y oculta el botón hamburguesa. Se deja que se encoja. */
  .md-navbar__brand {
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
  }
  .md-navbar__brand-name {
    display: none;
  }
  .md-content {
    padding: 16px;
    max-width: 100%;
    overflow-x: hidden;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Responsive: tablas con scroll horizontal en pantallas chicas ----
   .md-table-card usa overflow:hidden (para el border-radius); en móvil se
   permite scroll horizontal para que las tablas anchas no se recorten. */
@media (max-width: 768px) {
  .md-table-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ---- Responsive: formularios en una sola columna en móvil ----
   Los formularios (agr.html y modales de edición) usan grids inline
   "grid-template-columns:1fr 1fr". El estilo inline gana sobre el CSS,
   por eso se fuerza una sola columna con !important dentro de forms/cards/modales. */
@media (max-width: 600px) {
  form [style*="grid-template-columns"],
  .md-modal-body [style*="grid-template-columns"],
  .md-card__body [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

/* ---- Responsive: modales en pantallas chicas ---- */
@media (max-width: 600px) {
  .md-modal-dialog {
    width: 95%;
    max-height: 92vh;
  }
  .md-modal-header {
    padding: 16px 16px 12px;
  }
  .md-modal-title {
    font-size: 18px;
  }
  .md-modal-body {
    padding: 16px;
  }
  .md-modal-footer {
    padding: 12px 16px 16px;
    flex-wrap: wrap;
  }
}
@media (max-width: 420px) {
  .md-modal-footer .md-btn {
    flex: 1 1 100%;
    justify-content: center;
  }
}

/* ---- Responsive: login en teléfonos pequeños ---- */
@media (max-width: 480px) {
  .login-form-panel {
    padding: 32px 20px;
  }
  .login-title {
    font-size: 22px;
  }
  .login-subtitle {
    font-size: 13px;
  }
}

/* ---- Responsive: backdrop del sidebar en móvil ----
   Se muestra al abrir el menú (.md-sidebar.mobile-open) para oscurecer el
   contenido y permitir cerrar tocando fuera. */
.md-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.2s ease;
}
@media (max-width: 768px) {
  .md-sidebar {
    z-index: 1000;
  }
  .md-sidebar-backdrop.visible {
    display: block;
    opacity: 1;
  }
}

/* =========================================
   19. TEMAS POR ENTIDAD (enti_estilo)
   DEFAULT = :root (teal, sin data-theme)
   ESCARLATA / ESMERALDA — se activan via
   document.documentElement.setAttribute('data-theme','...')
   ========================================= */

/* — Tema ESCARLATA — Paleta oficial —
   Rojo: #ad3333 | Azul marino: #003366 | Gris: #DADADA */
[data-theme="ESCARLATA"] {
  --md-primary:              #ad3333;
  --md-on-primary:           #ffffff;
  --md-primary-container:    #f5c6c6;
  --md-on-primary-container: #3b0000;
  --md-secondary:            #003366;
  --md-on-secondary:         #ffffff;
  --md-secondary-container:  #ccd6e8;
  --md-on-secondary-container: #001535;
  --md-tertiary:             #003366;
  --md-on-tertiary:          #ffffff;
  --md-tertiary-container:   #ccd6e8;
  --md-background:           #faf7f7;
  --md-on-background:        #1e1a1a;
  --md-surface:              #ffffff;
  --md-on-surface:           #1e1a1a;
  --md-surface-variant:      #DADADA;
  --md-on-surface-variant:   #3f3737;
  --md-surface-1:            #f0e8e8;
  --md-outline:              #7a6f6f;
  --md-outline-variant:      #DADADA;
}
[data-theme="ESCARLATA"] .md-navbar {
  background: #ad3333;
  box-shadow: 0 2px 8px rgba(173,51,51,0.4);
}
[data-theme="ESCARLATA"] .modal-header,
[data-theme="ESCARLATA"] .dataTables_wrapper table.dataTable thead th {
  background: #c24444; /* Un toque más claro que el #ad3333 */
}
[data-theme="ESCARLATA"] .md-footer {
  background: #003366;
  color: #ffffff;
  border-top-color: #003366;
}
[data-theme="ESCARLATA"] .md-footer a { color: #f5c6c6; }
[data-theme="ESCARLATA"] .login-visual-panel {
  background: linear-gradient(155deg, #ad3333 0%, #6a1f1f 40%, #003366 100%);
}
[data-theme="ESCARLATA"] .sidebar-profile__select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23ad3333' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
}

/* — Tema ESMERALDA — Verde profundo MD3 — */
[data-theme="ESMERALDA"] {
  --md-primary: #1b6b45;
  --md-on-primary: #ffffff;
  --md-primary-container: #a8f5c6;
  --md-on-primary-container: #002113;
  --md-secondary: #4d6657;
  --md-on-secondary: #ffffff;
  --md-secondary-container: #cfecd9;
  --md-on-secondary-container: #0a1f15;
  --md-tertiary: #3a6478;
  --md-on-tertiary: #ffffff;
  --md-tertiary-container: #bde9ff;
  --md-background: #f3fbf4;
  --md-on-background: #191c1a;
  --md-surface: #f9fbf9;
  --md-on-surface: #191c1a;
  --md-surface-variant: #daeadd;
  --md-on-surface-variant: #3e4a41;
  --md-surface-1: #e6f4eb;
  --md-outline: #6e7971;
  --md-outline-variant: #beccbf;
}
[data-theme="ESMERALDA"] .md-navbar {
  background: linear-gradient(90deg, #1b6b45 0%, #228052 100%);
  box-shadow: 0 2px 8px rgba(27, 107, 69, 0.4);
}
[data-theme="ESMERALDA"] .modal-header,
[data-theme="ESMERALDA"] .dataTables_wrapper table.dataTable thead th {
  background: #238556; /* Un toque más claro que el #1b6b45 */
}
[data-theme="ESMERALDA"] .login-visual-panel {
  background: linear-gradient(155deg, #1b6b45 0%, #124d31 45%, #062015 100%);
}
[data-theme="ESMERALDA"] .sidebar-profile__select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%231B6B45' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
}

/* =========================================
   17. PURE MATERIAL DIALOGS (MODALS)
   ========================================= */
.md-modal {
  position: fixed;
  /* inset:0 dimensiona el overlay al viewport SIN incluir la barra de scroll
     (a diferencia de 100vw/100vh, que expanden el layout viewport y, al ser
     fixed, no los recorta overflow-x:hidden → desplazan toda la página). */
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s cubic-bezier(0.2, 0, 0, 1);
}
.md-modal.show {
  pointer-events: auto;
  opacity: 1;
}

.md-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s ease;
}

.md-modal-dialog {
  position: relative;
  z-index: 2001;
  background: var(--md-surface);
  border-radius: var(--md-radius-xl);
  box-shadow: var(--md-shadow-4);
  width: 90%;
  max-width: min(800px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
}
.md-modal.show .md-modal-dialog {
  transform: scale(1) translateY(0);
}

.md-modal-header {
  padding: 24px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--md-outline-variant);
}
.md-modal-title {
  font-size: 22px;
  font-weight: 400;
  color: var(--md-on-surface);
  display: flex;
  align-items: center;
  margin: 0;
  line-height: 1.4;
}

.md-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.md-modal-footer {
  padding: 16px 24px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--md-outline-variant);
}

/* =========================================
   18. DATATABLES PREMIUM MD3 STYLING
   ========================================= */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  margin-bottom: 16px;
}

.dataTables_wrapper .dataTables_length select {
  padding: 6px 32px 6px 12px;
  border: 1.5px solid var(--md-outline-variant);
  border-radius: var(--md-radius-sm);
  background: var(--md-surface);
  color: var(--md-on-surface);
  font-size: 13px;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236f797a' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.dataTables_wrapper .dataTables_filter input {
  padding: 8px 12px;
  border: 1.5px solid var(--md-outline-variant);
  border-radius: var(--md-radius-sm);
  background: var(--md-surface);
  color: var(--md-on-surface);
  font-size: 14px;
  outline: none;
  transition: var(--md-transition);
}
.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--md-primary);
  box-shadow: 0 0 0 3px rgba(0, 104, 116, 0.1);
}

.dataTables_wrapper table.dataTable thead th {
  background: #1b7a85; /* Un toque más claro que el primary #006874 */
  color: var(--md-on-primary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
  padding: 16px;
  border-bottom: none;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--md-radius-full) !important;
  border: none !important;
  padding: 6px 12px !important;
  font-size: 13px !important;
  transition: var(--md-transition) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--md-primary) !important;
  color: var(--md-on-primary) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current) {
  background: var(--md-surface-variant) !important;
  color: var(--md-on-surface) !important;
}

/* Chips / Badges MD3 */
.md-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--md-radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}
.md-chip--success {
  background-color: #e8f5e9;
  color: #2e7d32;
}
.md-chip--error {
  background-color: #ffebee;
  color: #c62828;
}
.md-chip--warning {
  background-color: #fff8e1;
  color: #f9a825;
}
.md-chip--neutral {
  background-color: var(--md-surface-variant);
  color: var(--md-on-surface-variant);
}

.swal2-container {
  z-index: 3000 !important;
}

/* =========================================
   19. MATERIAL DESIGN DIALOGS (ALERTS)
   ========================================= */
.md-dialog-overlay {
  position: fixed;
  /* inset:0 en vez de 100vw/100vh: evita expandir el layout viewport (ver .md-modal). */
  inset: 0;
  z-index: 4000;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.md-dialog-overlay.show {
  opacity: 1;
  visibility: visible;
}

.md-dialog {
  background: var(--md-surface);
  border-radius: 28px;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.25), 
              0 12px 24px -8px rgba(0, 0, 0, 0.1);
  width: 90%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Importante para que el header/footer respeten los radios */
  transform: scale(0.85);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(0, 0, 0, 0.1);
}
.md-dialog-overlay.show .md-dialog {
  transform: scale(1);
}

/* --- SECCIONES PREMIUM --- */
.md-dialog__header {
  padding: 24px 24px 16px 24px;
  background: rgba(0, 104, 116, 0.03); /* Tinte primario muy sutil */
  border-bottom: 1px solid rgba(0, 104, 116, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.md-dialog__body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.md-dialog__footer {
  padding: 16px 24px 24px 24px;
  background: rgba(0, 0, 0, 0.01);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: center;
  gap: 12px;
}

.md-dialog__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: scale(0);
}
.md-dialog-overlay.show .md-dialog__icon {
  transform: scale(1);
}

/* Iconic Status Containers */
.md-dialog__icon--success { background: rgba(46, 125, 50, 0.1); color: #2e7d32; box-shadow: 0 0 20px rgba(46, 125, 50, 0.1); }
.md-dialog__icon--error   { background: rgba(186, 26, 26, 0.1); color: var(--md-error); box-shadow: 0 0 20px rgba(186, 26, 26, 0.1); }
.md-dialog__icon--warning { background: rgba(249, 168, 37, 0.1); color: #f9a825; box-shadow: 0 0 20px rgba(249, 168, 37, 0.1); }
.md-dialog__icon--info    { background: rgba(0, 104, 116, 0.1); color: var(--md-primary); box-shadow: 0 0 20px rgba(0, 104, 116, 0.1); }

.md-dialog__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--md-on-surface);
  text-align: center;
  line-height: 1.3;
}

.md-dialog__text {
  font-size: 14px;
  color: var(--md-on-surface-variant);
  text-align: center;
  line-height: 1.5;
}

.md-dialog__error-msg {
  color: var(--md-error);
  font-size: 13px;
  margin-top: 4px;
  text-align: center;
  font-weight: 500;
  padding: 10px;
  background: rgba(186, 26, 26, 0.04);
  border-radius: 12px;
  border: 1px dashed rgba(186, 26, 26, 0.2);
}

/* Adjustments for validation list inside body */
.md-dialog__body ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.md-dialog__body li {
  padding: 4px 0;
  font-size: 13px;
  color: var(--md-on-surface-variant);
}



/* Animations */
@keyframes md-dialog-in {
  from { opacity: 0; transform: scale(0.8) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 400px) {
  .md-dialog {
    width: 95%;
  }
}

@media (max-width: 320px) {
  .md-dialog__footer {
    flex-direction: column-reverse;
    align-items: stretch;
    padding: 16px;
  }
  .md-dialog__footer .md-btn {
    width: 100%;
    margin: 0;
  }
}



/* --- Autocomplete Component --- */
.md-autocomplete-wrapper { position: relative; }
.md-autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--md-surface-container-high);
  border: 1px solid var(--md-outline-variant);
  border-radius: 0 0 12px 12px;
  box-shadow: var(--md-elevation-3);
  z-index: 1000;
  display: none;
  max-height: 300px;
  overflow-y: auto;
}
.md-autocomplete-dropdown.show { display: block; }
.md-autocomplete-item {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}
.md-autocomplete-item:hover { background: var(--md-primary-container); }
.md-autocomplete-item:not(:last-child) { border-bottom: 1px solid var(--md-outline-variant); }
