/* Reset y Variables CSS - Similar a CSS Modules o Styled Components en React */
:root {
  --primary-color: #2563eb;
  --secondary-color: #1e40af;
  --text-color: #1f2937;
  --text-light: #6b7280;
  --bg-color: #ffffff;
  --bg-secondary: #f3f4f6;
  --border-color: #e5e7eb;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  --info-color: #3b82f6;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --border-radius: 0.5rem;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  color: var(--text-color);
  background-color: var(--bg-color);
  line-height: 1.6;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

/* Navbar */
.navbar {
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  padding: var(--spacing-md) 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  text-decoration: none;
}

.navbar-menu {
  display: flex;
  list-style: none;
  gap: var(--spacing-lg);
}

.navbar-menu a {
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.2s;
}

.navbar-menu a:hover {
  color: var(--primary-color);
}

/* Main Content */
main {
  min-height: calc(100vh - 200px);
  padding: var(--spacing-2xl) 0;
}

.app-layout main {
  padding: 1.5rem;
  min-height: auto;
  flex: 1;
}

/* Footer */
.footer {
  background-color: var(--bg-secondary);
  padding: var(--spacing-xl) 0;
  margin-top: var(--spacing-2xl);
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
  text-align: center;
  color: var(--text-light);
}

/* Cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-lg);
  margin-top: var(--spacing-xl);
}

.card {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card h2 {
  margin-bottom: var(--spacing-md);
  color: var(--primary-color);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: var(--spacing-sm) var(--spacing-lg);
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--secondary-color);
}

/* Forms */
.contact-form {
  max-width: 600px;
  margin: var(--spacing-xl) auto;
}

.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-group label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: 500;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: var(--spacing-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-family: inherit;
  font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Page 404 */
.page-404 {
  text-align: center;
  padding: var(--spacing-2xl) 0;
}

.page-404 h1 {
  font-size: 6rem;
  color: var(--primary-color);
  margin-bottom: var(--spacing-lg);
}

/* Reset main wrapper padding for auth pages (login) */
.auth-layout main {
  min-height: 100vh;
  padding: 0;
}

/* Login Page */
.page-login {
  min-height: 100vh;
  display: flex;
}

.login-panel-left {
  width: 50%;
  background-color: #68101c;
  display: flex;
  flex-direction: column;
  padding: 2.5rem;
  color: #fff;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.login-brand-img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: contain;
}

.login-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.login-brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.login-brand-sub {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.65);
}

.login-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 480px;
}

.login-hero h2 {
  font-size: 2.15rem;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  margin-bottom: 1rem;
}

.login-hero p {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.65;
}

.login-left-footer {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
}

.login-panel-right {
  width: 50%;
  background-color: #f7f7f7;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 2.5rem;
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 400px;
}

.login-header {
  margin-bottom: 1.75rem;
}

.login-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 0.3rem;
}

.login-header p {
  font-size: 0.88rem;
  color: #6b7280;
}

.login-form .form-group {
  margin-bottom: 1.2rem;
}

.login-form label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 0.45rem;
}

.login-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}

.login-field-header label {
  margin-bottom: 0;
}

.login-forgot {
  font-size: 0.76rem;
  color: #9b1b2e;
  text-decoration: none;
}

.login-forgot:hover {
  text-decoration: underline;
}

.btn-login {
  display: block;
  width: 100%;
  padding: 0.75rem;
  background-color: #9b1b2e;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.97rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-top: 0.5rem;
}

.btn-login:hover {
  background-color: #7a1020;
}

.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-support {
  text-align: center;
  font-size: 0.76rem;
  color: #9ca3af;
  margin-top: 1.5rem;
}

@media (max-width: 768px) {
  .page-login {
    flex-direction: column;
  }

  .login-panel-left {
    width: 100%;
    min-height: 220px;
  }

  .login-panel-right {
    width: 100%;
  }

  .login-hero h2 {
    font-size: 1.5rem;
  }
}

/* Dashboard Page */
.page-dashboard {
  padding: var(--spacing-xl) 0;
}

.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-2xl);
}

.stat-card {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-blue {
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--primary-color);
}

.stat-icon-green {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}

.stat-icon-yellow {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
}

.stat-icon-purple {
  background-color: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

.stat-content h3 {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: var(--spacing-xs);
  font-weight: 500;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text-color);
  margin-bottom: var(--spacing-xs);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Dashboard Section */
.dashboard-section {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

.section-header h2 {
  margin: 0;
}

/* Table */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background-color: var(--bg-secondary);
}

.data-table th,
.data-table td {
  padding: var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  font-weight: 600;
  color: var(--text-light);
  font-size: 0.875rem;
}

.data-table tbody tr:hover {
  background-color: var(--bg-secondary);
}

.text-center {
  text-align: center;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--border-radius);
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pagada {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}

.status-pendiente {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
}

.status-vencida {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--error-color);
}

/* Responsive */
@media (max-width: 768px) {
  .navbar-container {
    flex-direction: column;
    gap: var(--spacing-md);
  }

  .navbar-menu {
    flex-direction: column;
    gap: var(--spacing-sm);
    text-align: center;
  }

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

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

/* ============================================================
   TOPBAR + SIDEBAR LAYOUT
   ============================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
  background: #f4f6f9;
}

/* ── Topbar ── */
.app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  z-index: 102;
  padding-right: 1.25rem;
}

/* ── Notification panel ── */
.notif-panel {
  position: fixed;
  top: 58px;
  right: 1rem;
  width: 310px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 300;
  overflow: hidden;
}
.notif-panel[hidden] {
  display: none;
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem 0.625rem;
}
.notif-panel-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #111827;
}
.notif-panel-unread {
  font-size: 0.75rem;
  color: #6b7280;
}

.notif-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid #f3f4f6;
}

.notif-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f9fafb;
  transition: background 0.12s;
  cursor: default;
}
.notif-item:last-child {
  border-bottom: none;
}
.notif-item:hover {
  background: #f9fafb;
}

.notif-dot-wrap {
  padding-top: 0.3rem;
  flex-shrink: 0;
  width: 10px;
}
.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
}

.notif-body {
  flex: 1;
  min-width: 0;
}
.notif-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.15rem;
}
.notif-sub {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
}
.notif-time {
  font-size: 0.7rem;
  color: #9ca3af;
}

.notif-panel-footer {
  padding: 0.625rem 1rem;
  text-align: center;
  border-top: 1px solid #f3f4f6;
}
.notif-panel-footer a {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #3b82f6;
  text-decoration: none;
}
.notif-panel-footer a:hover {
  text-decoration: underline;
}

.topbar-toggle {
  width: 56px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  flex-shrink: 0;
  transition: color 0.15s;
}
.topbar-toggle:hover {
  color: #111827;
}
.topbar-toggle .icon-close {
  display: none;
}
body.sidebar-expanded .topbar-toggle .icon-open {
  display: none;
}
body.sidebar-expanded .topbar-toggle .icon-close {
  display: block;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-notif {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  display: flex;
  align-items: center;
  padding: 0.35rem;
  border-radius: 6px;
  transition:
    color 0.15s,
    background 0.15s;
}
.topbar-notif:hover {
  color: #111827;
  background: #f3f4f6;
}

.topbar-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  background: #dc2626;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.topbar-badge[hidden] {
  display: none;
}

.topbar-user-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  cursor: default;
}

.topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #1e293b;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.topbar-username {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
}

/* ── Sidebar ── */
.sidebar {
  width: 56px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 103;
  overflow: hidden;
  transition: width 0.22s ease;
}

.sidebar-brand {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
  overflow: hidden;
}

body.sidebar-expanded .sidebar-brand {
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0 0 0 0.75rem;
}

.sidebar-brand-logo {
  display: none;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: contain;
}

body.sidebar-expanded .sidebar-brand-logo {
  display: block;
}

.sidebar-brand-text {
  flex: 1;
  min-width: 0;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition:
    opacity 0.18s ease,
    max-width 0.22s ease;
}

body.sidebar-expanded .sidebar-brand-text {
  opacity: 1;
  max-width: 130px;
}

.sidebar-brand-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  line-height: 1.2;
}

.sidebar-brand-sub {
  display: block;
  font-size: 0.7rem;
  color: #9ca3af;
  white-space: nowrap;
}

.sidebar-brand-toggle {
  width: 56px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  flex-shrink: 0;
  transition:
    color 0.15s,
    background 0.15s;
}

body.sidebar-expanded .sidebar-brand-toggle {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  margin-left: auto;
  margin-right: 0.35rem;
}

.sidebar-brand-toggle:hover {
  color: #374151;
  background: #f3f4f6;
}

.sidebar-brand-toggle .icon-expand {
  display: flex;
}
.sidebar-brand-toggle .icon-collapse {
  display: none;
}
body.sidebar-expanded .sidebar-brand-toggle .icon-expand {
  display: none;
}
body.sidebar-expanded .sidebar-brand-toggle .icon-collapse {
  display: flex;
}

body.sidebar-expanded .sidebar {
  width: 220px;
}

.app-content {
  margin-left: 56px;
  padding-top: 52px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.22s ease;
}

body.sidebar-expanded .app-content {
  margin-left: 220px;
}

/* Nav links */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.4rem;
  flex: 1;
  gap: 0.15rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0.65rem;
  border-radius: 8px;
  color: #6b7280;
  text-decoration: none;
  transition:
    background 0.15s,
    color 0.15s;
  white-space: nowrap;
  overflow: hidden;
}

body.sidebar-expanded .sidebar-link {
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
}

.sidebar-link:hover {
  background: #f3f4f6;
  color: #111827;
}

.sidebar-link.active {
  background: #fee2e2;
  color: #dc2626;
}

.sidebar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.sidebar-label {
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition:
    opacity 0.18s ease,
    max-width 0.22s ease;
}

body.sidebar-expanded .sidebar-label {
  opacity: 1;
  max-width: 160px;
}

.sidebar-footer {
  padding: 0.4rem;
  border-top: 1px solid #f3f4f6;
}

.sidebar-logout {
  text-align: left;
  color: #6b7280;
}

.sidebar-logout:hover {
  background: #fef2f2;
  color: #dc2626;
}

/* Ajustar páginas que tenían fondo propio */
.page-dashboard {
  background: transparent;
  min-height: auto;
  padding: 0;
}

.dashboard-container {
  padding-top: 1rem;
}

/* Mobile */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .app-content {
    margin-left: 0;
  }
  body.sidebar-expanded .sidebar {
    transform: translateX(0);
  }
  body.sidebar-expanded .app-content {
    margin-left: 0;
  }
}

/* ============================================================
   DASHBOARD FORM STYLES
   ============================================================ */

.dash-header {
  margin-bottom: 2rem;
}

.dash-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.form-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 2rem;
  max-width: 600px;
}

.empresa-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.form-group input {
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-family: inherit;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.form-group input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-actions {
  margin-top: 1rem;
}

.btn-primary {
  background-color: #2563eb;
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s;
}

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

/* Estilos para checkboxes de ISOs */
.isos-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background-color: #f9fafb;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s;
}

.checkbox-item:hover {
  border-color: #2563eb;
  background-color: #eff6ff;
}

.checkbox-item input[type='checkbox'] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.checkbox-item span {
  font-size: 0.875rem;
  color: #374151;
}

.checkbox-item input[type='checkbox']:checked + span {
  color: #2563eb;
  font-weight: 500;
}
