:root {
  --primary: #073260;
  --primary-light: #1e4b8a;
  --secondary: #408ad9;
  --accent: #ead2ac;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}


body {
  margin: 0 !important;
  padding: 0 !important;
  background-color: var(--bg-main) !important;
  background-image: radial-gradient(at 0% 0%, rgba(30, 64, 175, 0.05) 0, transparent 50%), 
                    radial-gradient(at 50% 0%, rgba(139, 92, 246, 0.05) 0, transparent 50%) !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 100vh !important;
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
}


body.with-sidebar {
  /* Se elimina flex-direction y display:flex para evitar conflictos con position:fixed del sidebar */
  display: block !important;
  flex-direction: unset !important;
}


body.login {
  background-image: url('../img/fondo-gestmat.png') !important;
  background-size: cover !important;
  background-repeat: no-repeat !important;
  background-position: center center !important;
  background-attachment: fixed !important;
  /* Si quieres además un degradado encima de la imagen, usa background-color y background-blend-mode */
  background-color: rgba(237, 239, 241, 0.35) !important;
  /* overlay suave */
  background-blend-mode: overlay !important;

  min-height: 100vh;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px;
  flex-direction: row !important;
}


body.home {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  color: #333;
  overflow-x: hidden;
  display: block !important;
  flex-direction: unset !important;
}


main {
  flex: 1;
  padding: 20px;
  padding-top: 20px;
  margin-bottom: 30px;
  min-height: calc(100vh - 200px);
  padding-bottom: 2rem;
  width: calc(100% - 70px);
  margin-left: 70px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
}

/* Fix: Sidebar is nested inside header. Use general sibling selector to bypass <br> tags. */
header:has(.sidebar) ~ main {
  margin-left: 70px !important;
  width: calc(100% - 70px) !important;
}

header:has(.sidebar):hover ~ main {
  margin-left: 260px !important;
  width: calc(100% - 260px) !important;
}




/* Regla base para el contenido principal (ocupa todo el espacio cuando no hay sidebar) */
body:not(.with-sidebar) main {
  margin-left: 0 !important;
  width: 100% !important;
  filter: blur(0) !important;
  pointer-events: auto !important;
}


/* Base behavior for content when sidebar is present */
.main-content {
  margin-left: 70px;
  width: calc(100% - 70px);
}

body.home main {
  flex: unset;
  padding-top: 0;
  margin-bottom: 0;
  min-height: unset;
  padding-bottom: unset;
}



.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 70px;
  height: 100vh;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-hover) 100%);
  padding: 20px 0;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  border-right: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar:hover {
  width: 260px;
}

.container-1 {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 20px 20px 70px; /* Safe padding for sidebar overlay */
}

.container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 50px; /* Safe padding */
  box-sizing: border-box;
}


.style-form,
.style-form-1 {
  padding: 40px 40px 40px 80px; /* Safe padding for sidebar overlay */
  border-radius: 12px;
  box-shadow: 0px 8px 30px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  background-color: rgba(255, 255, 255, 0.2);
  width: 100%;
  max-width: 1000px;
  box-sizing: border-box;
}


/* ========================================
   RESPONSIVE UTILITIES
   ======================================== */

/* Hide/Show utilities for different breakpoints */
.hide-mobile {
  display: none !important;
}

.show-mobile {
  display: block !important;
}

.hide-tablet,
.hide-desktop {
  display: block !important;
}

.show-tablet,
.show-desktop {
  display: none !important;
}

/* Text alignment utilities for mobile */
.text-center-mobile {
  text-align: center !important;
}

.text-left-mobile {
  text-align: left !important;
}

/* Stack utility for mobile */
.stack-mobile {
  flex-direction: column !important;
}

/* ========================================
   TABLET BREAKPOINT (768px - 1024px)
   ======================================== */
@media (min-width: 768px) and (max-width: 1024px) {
  .hide-tablet {
    display: none !important;
  }

  .show-tablet {
    display: block !important;
  }

  main {
    padding: 15px;
    padding-top: 70px;
  }

  .container-1 {
    padding: 15px;
  }

  .style-form,
  .style-form-1 {
    padding: 30px;
  }
}

/* ========================================
   DESKTOP BREAKPOINT (> 1024px)
   ======================================== */
@media (min-width: 1024px) {
  .hide-desktop {
    display: none !important;
  }

  .show-desktop {
    display: block !important;
  }

  .hide-mobile,
  .hide-tablet {
    display: block !important;
  }

  .show-mobile,
  .show-tablet {
    display: none !important;
  }
}

/* ========================================
   MOBILE BREAKPOINT (< 768px)
   ======================================== */
@media (max-width: 768px) {

  /* Main content adjustments */
  main {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 10px;
    padding-top: 60px;
    margin-bottom: 100px;
  }

  .sidebar~main {
    margin-left: 0 !important;
    width: 100% !important;
    filter: blur(0) !important;
    pointer-events: auto !important;
  }

  .sidebar:hover~main {
    margin-left: 0 !important;
    width: 100% !important;
    filter: blur(0) !important;
    pointer-events: auto !important;
  }

  /* Sidebar mobile behavior */
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
    transition: transform 0.3s ease;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Forms responsive */
  .style-form,
  .style-form-1 {
    padding: 15px;
    margin: 0 5px;
    max-width: 100%;
  }

  /* Containers responsive */
  .container-1 {
    padding: 10px;
  }

  .container {
    padding: 10px;
  }

  /* Utility classes active on mobile */
  .hide-mobile {
    display: none !important;
  }

  .show-mobile {
    display: block !important;
  }

  .hide-tablet,
  .hide-desktop {
    display: block !important;
  }

  .show-tablet,
  .show-desktop {
    display: none !important;
  }
}

/* ========================================
   EXTRA SMALL MOBILE (< 480px)
   ======================================== */
@media (max-width: 480px) {
  main {
    padding: 8px;
    padding-top: 50px;
  }

  .style-form,
  .style-form-1 {
    padding: 12px;
    margin: 0;
  }

  .container-1 {
    padding: 8px;
  }
}