/* ==========================================================================
   SISTEMA DE MESA DE PARTES & TRÁMITE DOCUMENTARIO - IESTP PUERTO LIBRE
   Diseño Premium, Moderno y 100% Responsivo para Móviles, Tablets y Desktop
   ========================================================================== */

:root {
  --mdp-primary: #1e3a8a;
  --mdp-primary-light: #3b82f6;
  --mdp-primary-dark: #0f172a;
  --mdp-accent: #f59e0b;
  --mdp-accent-hover: #d97706;
  --mdp-success: #10b981;
  --mdp-success-bg: #ecfdf5;
  --mdp-danger: #ef4444;
  --mdp-danger-bg: #fef2f2;
  --mdp-warning: #f59e0b;
  --mdp-warning-bg: #fffbeb;
  --mdp-info: #0ea5e9;
  --mdp-info-bg: #f0f9ff;
  --mdp-bg: #f8fafc;
  --mdp-card-bg: #ffffff;
  --mdp-text-main: #1e293b;
  --mdp-text-muted: #64748b;
  --mdp-border: #e2e8f0;
  --mdp-sidebar-bg: #0f172a;
  --mdp-sidebar-text: #94a3b8;
  --mdp-sidebar-active: #2563eb;
  --mdp-radius-sm: 8px;
  --mdp-radius-md: 12px;
  --mdp-radius-lg: 18px;
  --mdp-shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
  --mdp-shadow-md: 0 4px 12px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.03);
  --mdp-shadow-lg: 0 10px 25px -5px rgba(15,23,42,0.08), 0 8px 10px -6px rgba(15,23,42,0.04);
  --mdp-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--mdp-bg);
  color: var(--mdp-text-main);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* Layout Wrapper */
.mdp-app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  position: relative;
}

/* Backdrop for Mobile Sidebar */
.mdp-sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1035;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mdp-sidebar-backdrop.show {
  display: block;
  opacity: 1;
}

/* Sidebar */
.mdp-sidebar {
  width: 270px;
  background: var(--mdp-sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  transition: var(--mdp-transition);
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.mdp-sidebar-brand {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
}

.mdp-brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  padding: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.mdp-brand-text h2 {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.2;
}

.mdp-brand-text span {
  font-size: 11px;
  color: var(--mdp-accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.mdp-sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px;
  list-style: none;
  margin: 0;
}

.mdp-menu-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #475569;
  font-weight: 700;
  padding: 12px 10px 4px;
}

.mdp-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--mdp-sidebar-text);
  text-decoration: none;
  border-radius: var(--mdp-radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--mdp-transition);
  margin-bottom: 3px;
  position: relative;
}

.mdp-nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
  transform: translateX(3px);
}

.mdp-nav-link.active {
  background: linear-gradient(135deg, var(--mdp-primary-light) 0%, var(--mdp-primary) 100%);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.mdp-nav-link i {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.mdp-nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.15);
}

/* User Box in Sidebar Footer */
.mdp-sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
}

.mdp-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #1e3a8a 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.mdp-user-info {
  flex: 1;
  min-width: 0;
}

.mdp-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.mdp-user-role {
  font-size: 11px;
  color: var(--mdp-accent);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Main Content Area */
.mdp-main-content {
  flex: 1;
  margin-left: 270px;
  width: calc(100% - 270px);
  max-width: calc(100% - 270px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--mdp-transition);
}

/* Topbar */
.mdp-topbar {
  min-height: 64px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--mdp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.mdp-topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mdp-topbar-title h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--mdp-primary-dark);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mdp-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Content Body */
.mdp-content-body {
  flex: 1;
  padding: 24px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* Stat Cards Grid */
.mdp-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
  width: 100%;
}

.mdp-stat-card {
  background: var(--mdp-card-bg);
  border-radius: var(--mdp-radius-md);
  padding: 18px 20px;
  border: 1px solid var(--mdp-border);
  box-shadow: var(--mdp-shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--mdp-transition);
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.mdp-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--mdp-shadow-md);
  border-color: #cbd5e1;
}

.mdp-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--mdp-primary-light);
}

.mdp-stat-card.stat-blue::before { background: #3b82f6; }
.mdp-stat-card.stat-emerald::before { background: #10b981; }
.mdp-stat-card.stat-amber::before { background: #f59e0b; }
.mdp-stat-card.stat-purple::before { background: #8b5cf6; }
.mdp-stat-card.stat-rose::before { background: #ef4444; }

.mdp-stat-info {
  min-width: 0;
  flex: 1;
}

.mdp-stat-info span {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--mdp-text-muted);
  display: block;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mdp-stat-info h3 {
  font-size: 24px;
  font-weight: 700;
  color: var(--mdp-primary-dark);
  margin: 0;
  line-height: 1.2;
}

.mdp-stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
  margin-left: 8px;
}

.stat-blue .mdp-stat-icon { background: #eff6ff; color: #2563eb; }
.stat-emerald .mdp-stat-icon { background: #ecfdf5; color: #10b981; }
.stat-amber .mdp-stat-icon { background: #fffbeb; color: #f59e0b; }
.stat-purple .mdp-stat-icon { background: #f5f3ff; color: #8b5cf6; }
.stat-rose .mdp-stat-icon { background: #fef2f2; color: #ef4444; }

/* Panels & Cards */
.mdp-card {
  background: var(--mdp-card-bg);
  border-radius: var(--mdp-radius-md);
  border: 1px solid var(--mdp-border);
  box-shadow: var(--mdp-shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
  width: 100%;
}

.mdp-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--mdp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  flex-wrap: wrap;
  gap: 10px;
}

.mdp-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--mdp-primary-dark);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mdp-card-body {
  padding: 20px;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Badges */
.badge-mdp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

/* Buttons */
.btn-mdp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--mdp-radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--mdp-transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-mdp-primary {
  background: linear-gradient(135deg, var(--mdp-primary-light) 0%, var(--mdp-primary) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-mdp-primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-mdp-accent {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

.btn-mdp-accent:hover {
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-mdp-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.btn-mdp-secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
  text-decoration: none;
}

.btn-mdp-success {
  background: #10b981;
  color: #fff;
}
.btn-mdp-success:hover {
  background: #059669;
  color: #fff;
}

/* Timeline */
.mdp-timeline {
  position: relative;
  padding: 10px 0 10px 24px;
}

.mdp-timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 15px;
  bottom: 15px;
  width: 2px;
  background: #cbd5e1;
}

.mdp-timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.mdp-timeline-dot {
  position: absolute;
  left: -24px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--mdp-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.mdp-timeline-item.active .mdp-timeline-dot {
  background: var(--mdp-primary);
  border-color: #93c5fd;
}

.mdp-timeline-item.success .mdp-timeline-dot {
  background: #10b981;
  border-color: #a7f3d0;
}

.mdp-timeline-content {
  background: #f8fafc;
  border: 1px solid var(--mdp-border);
  border-radius: var(--mdp-radius-sm);
  padding: 12px 14px;
}

.mdp-timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 4px;
}

.mdp-timeline-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--mdp-primary-dark);
  margin: 0;
}

.mdp-timeline-time {
  font-size: 11.5px;
  color: var(--mdp-text-muted);
}

.mdp-timeline-body {
  font-size: 12.5px;
  color: #334155;
  margin: 0;
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================================== */

/* Tablets & Pantallas Medianas (<= 991px) */
@media (max-width: 991.98px) {
  .mdp-sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.4);
  }
  
  .mdp-sidebar.open {
    transform: translateX(0);
  }

  .mdp-main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .mdp-topbar {
    padding: 10px 16px;
  }

  .mdp-content-body {
    padding: 18px 14px;
  }

  .mdp-stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

/* Móviles (<= 767.98px) */
@media (max-width: 767.98px) {
  .mdp-topbar {
    padding: 8px 12px;
    min-height: 56px;
  }

  .mdp-topbar-title h1 {
    font-size: 15px;
  }

  .mdp-content-body {
    padding: 14px 10px;
  }

  .mdp-stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }

  .mdp-stat-card {
    padding: 12px 14px;
    border-radius: 10px;
  }

  .mdp-stat-info span {
    font-size: 11px;
  }

  .mdp-stat-info h3 {
    font-size: 20px;
  }

  .mdp-stat-icon {
    width: 36px;
    height: 36px;
    font-size: 15px;
    border-radius: 8px;
    margin-left: 4px;
  }

  .mdp-card {
    border-radius: 10px;
    margin-bottom: 14px;
  }

  .mdp-card-header {
    padding: 12px 14px;
  }

  .mdp-card-title {
    font-size: 14px;
  }

  .mdp-card-body {
    padding: 14px 12px;
  }

  .btn-mdp {
    padding: 7px 12px;
    font-size: 12px;
  }

  /* DataTables Search and Length adjustments on Mobile */
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_length {
    float: none !important;
    text-align: left !important;
    margin-bottom: 8px;
  }

  .dataTables_wrapper .dataTables_filter input {
    width: 100% !important;
    margin-left: 0 !important;
    margin-top: 4px;
  }

  .dataTables_wrapper .dataTables_paginate {
    float: none !important;
    text-align: center !important;
    margin-top: 12px;
  }
}

/* Móviles Muy Pequeños (<= 420px) */
@media (max-width: 420px) {
  .mdp-stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .mdp-stat-card {
    padding: 10px 10px;
  }

  .mdp-stat-info span {
    font-size: 10px;
  }

  .mdp-stat-info h3 {
    font-size: 18px;
  }

  .mdp-stat-icon {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }
}

/* Print Stylesheet */
@media print {
  body {
    background: #fff !important;
    font-size: 12pt;
    color: #000;
  }
  .mdp-sidebar, .mdp-topbar, .mdp-sidebar-backdrop, .no-print, .btn, button {
    display: none !important;
  }
  .mdp-main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }
}
