/* =============================================================
   ECO NORMAS – Main Stylesheet
   Palette: Burgundy #6B0F1A / Gold #C9A84C / Cream #F5F0E8
   ============================================================= */

/* ---------- Custom properties ---------- */
:root {
  --burgundy:     #6B0F1A;
  --burgundy-d:   #4A0B12;
  --burgundy-l:   #8B1A28;
  --gold:         #C9A84C;
  --gold-l:       #E2C070;
  --gold-d:       #A8863A;
  --cream:        #F5F0E8;
  --cream-d:      #EDE6D6;
  --white:        #FFFFFF;
  --gray-50:      #F9F7F4;
  --gray-100:     #F0EBE3;
  --gray-200:     #DDD5C8;
  --gray-400:     #9B8E80;
  --gray-600:     #5C524A;
  --gray-800:     #2D2520;
  --text:         #1E1810;
  --text-muted:   #6B5F55;
  --success:      #1A6B3C;
  --danger:       #8B1A1A;
  --info:         #1A4A6B;
  --shadow-sm:    0 2px 8px rgba(107,15,26,.10);
  --shadow-md:    0 4px 20px rgba(107,15,26,.14);
  --shadow-lg:    0 8px 40px rgba(107,15,26,.18);
  --radius:       10px;
  --radius-lg:    16px;
  --transition:   .2s ease;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--gray-50);
}
h1,h2,h3,h4,h5 {
  font-family: 'Playfair Display', serif;
  line-height: 1.25;
}
a { color: var(--burgundy); text-decoration: none; }
a:hover { color: var(--burgundy-l); }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--cream-d); }
::-webkit-scrollbar-thumb { background: var(--burgundy); border-radius: 99px; }

/* =============================================================
   LAYOUT PRINCIPAL
   ============================================================= */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--burgundy-d);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition);
  overflow: hidden;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo .logo-circle {
  width: 42px; height: 42px;
  background: var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--burgundy-d);
  flex-shrink: 0;
}
.sidebar-logo .logo-text { color: white; }
.sidebar-logo .logo-main { display: block; font-size: 15px; font-weight: 600; }
.sidebar-logo .logo-sub  { display: block; font-size: 11px; opacity: .6; }

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.35);
  padding: 12px 20px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,.75);
  border-left: 3px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; }
.nav-item:hover { background: rgba(255,255,255,.07); color: white; border-left-color: rgba(201,168,76,.5); }
.nav-item.active { background: rgba(201,168,76,.15); color: var(--gold-l); border-left-color: var(--gold); font-weight: 500; }
.nav-badge {
  margin-left: auto;
  background: var(--gold);
  color: var(--burgundy-d);
  font-size: 11px;
  font-weight: 700;
  border-radius: 99px;
  padding: 1px 7px;
}
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,.8);
  font-size: 13px;
}
.sidebar-user .avatar {
  width: 34px; height: 34px;
  background: var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  color: var(--burgundy-d);
  flex-shrink: 0;
}
.sidebar-user .user-info .user-name { font-weight: 500; display: block; }
.sidebar-user .user-info .user-role { font-size: 11px; opacity: .55; display: block; }

/* Main content */
.main-content {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top bar */
.topbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-family: 'Playfair Display', serif; font-size: 20px; color: var(--burgundy-d); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-badge-admin {
  background: var(--burgundy);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.topbar-badge-auditor {
  background: var(--gold);
  color: var(--burgundy-d);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.btn-logout {
  font-size: 13px;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border-radius: 7px;
  border: 1px solid var(--gray-200);
  background: white;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-logout:hover { background: var(--gray-100); color: var(--danger); border-color: var(--danger); }
.btn-logout svg { width: 15px; height: 15px; }

/* Page inner */
.page-inner { padding: 32px; flex: 1; }

/* =============================================================
   STAT CARDS
   ============================================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.burgundy { background: rgba(107,15,26,.1); color: var(--burgundy); }
.stat-icon.gold     { background: rgba(201,168,76,.15); color: var(--gold-d); }
.stat-icon.success  { background: rgba(26,107,60,.1); color: var(--success); }
.stat-icon.info     { background: rgba(26,74,107,.1); color: var(--info); }
.stat-info .stat-value { font-size: 28px; font-family:'Playfair Display',serif; font-weight:700; color:var(--text); }
.stat-info .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* =============================================================
   CARDS / PANELS
   ============================================================= */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  overflow: hidden;
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 16px; font-family:'Playfair Display',serif; color:var(--burgundy-d); }
.card-body { padding: 24px; }

/* =============================================================
   TABLES
   ============================================================= */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  background: var(--gray-50);
  color: var(--gray-600);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }

/* =============================================================
   PROGRESS BAR
   ============================================================= */
.progress-bar-wrap {
  background: var(--gray-100);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  min-width: 100px;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--burgundy), var(--gold));
  border-radius: 99px;
  transition: width .6s ease;
}

/* =============================================================
   BADGES
   ============================================================= */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-iso      { background: rgba(26,74,107,.1);  color: var(--info); }
.badge-nom      { background: rgba(26,107,60,.1);  color: var(--success); }
.badge-interna  { background: rgba(201,168,76,.15); color: var(--gold-d); }
.badge-revisada { background: rgba(26,107,60,.12); color: var(--success); }
.badge-pendiente{ background: rgba(107,15,26,.08); color: var(--burgundy); }

/* =============================================================
   FORMS
   ============================================================= */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  margin-bottom: 6px;
}
.input-wrap { position: relative; }
.input-wrap .input-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px;
  stroke: var(--gray-400); fill: none; stroke-width: 1.8;
  pointer-events: none;
}
.input-wrap input,
.input-wrap select {
  padding-left: 40px !important;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  background: white;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--burgundy);
  box-shadow: 0 0 0 3px rgba(107,15,26,.08);
}
textarea { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* =============================================================
   BUTTONS
   ============================================================= */
.btn-primary {
  background: var(--burgundy);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary:hover { background: var(--burgundy-l); box-shadow: 0 4px 12px rgba(107,15,26,.3); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-gold {
  background: var(--gold);
  color: var(--burgundy-d);
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 7px;
}
.btn-gold:hover { background: var(--gold-l); box-shadow: 0 3px 10px rgba(201,168,76,.4); }
.btn-outline {
  background: transparent;
  color: var(--burgundy);
  border: 1.5px solid var(--burgundy);
  padding: 9px 18px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 7px;
}
.btn-outline:hover { background: var(--burgundy); color: white; }
.btn-sm { padding: 7px 14px !important; font-size: 12px !important; }
.btn-full { width: 100%; justify-content: center; }
.btn-danger { background: var(--danger); color: white; border: none; padding: 9px 18px; border-radius: var(--radius); font-size: 13px; cursor:pointer; transition: all var(--transition); }
.btn-danger:hover { background: #a31f1f; }

/* =============================================================
   ALERTS
   ============================================================= */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-error   { background: rgba(139,26,26,.08); color: var(--danger); border: 1px solid rgba(139,26,26,.2); }
.alert-success { background: rgba(26,107,60,.08); color: var(--success); border: 1px solid rgba(26,107,60,.2); }
.alert-info    { background: rgba(26,74,107,.08); color: var(--info); border: 1px solid rgba(26,74,107,.2); }

/* =============================================================
   MODAL
   ============================================================= */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(30,24,16,.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition);
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-family:'Playfair Display',serif; font-size:18px; color:var(--burgundy-d); }
.modal-close {
  width: 30px; height: 30px;
  border: none; background: var(--gray-100); border-radius: 50%;
  cursor: pointer; font-size: 18px; color: var(--gray-600);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--gray-200); color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-100); display: flex; justify-content: flex-end; gap: 10px; }

/* =============================================================
   LOGIN PAGE
   ============================================================= */
.login-body { background: var(--cream); }
.login-split { display: flex; min-height: 100vh; }

.login-brand {
  width: 45%;
  background: var(--burgundy-d);
  display: flex; align-items: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
}
.brand-content { position: relative; z-index: 2; }
.brand-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 48px; }
.brand-logo .logo-circle {
  width: 52px; height: 52px;
  background: var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif; font-weight: 700;
  font-size: 14px; color: var(--burgundy-d);
}
.brand-logo .logo-main { display:block; font-size:18px; font-weight:600; color:white; }
.brand-logo .logo-sub  { display:block; font-size:12px; color:rgba(255,255,255,.5); }
.brand-headline {
  font-size: 38px;
  font-family: 'Playfair Display', serif;
  color: white;
  line-height: 1.2;
  margin-bottom: 16px;
}
.brand-headline em { color: var(--gold); font-style: normal; }
.brand-desc { color: rgba(255,255,255,.6); font-size: 15px; line-height: 1.7; margin-bottom: 32px; }
.brand-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.brand-badges span {
  padding: 5px 12px;
  border: 1px solid rgba(201,168,76,.4);
  color: var(--gold-l);
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
}
.brand-bg-shape {
  position: absolute; right: -120px; top: -120px;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: rgba(201,168,76,.06);
  border: 1px solid rgba(201,168,76,.1);
  pointer-events: none;
}
.login-form-panel {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 48px;
  background: var(--cream);
}
.login-card {
  width: 100%; max-width: 420px;
  background: white;
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-md);
}
.login-card h2 { font-size: 28px; color: var(--burgundy-d); margin-bottom: 6px; }
.login-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }

/* =============================================================
   NORMAS READER
   ============================================================= */
.norma-content {
  background: white;
  border-radius: var(--radius-lg);
  padding: 32px 40px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  line-height: 1.8;
  max-width: 800px;
  margin: 0 auto;
}
.norma-content h1 { font-size: 26px; color: var(--burgundy-d); margin-bottom: 8px; }
.norma-content .norma-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; padding-bottom: 16px; border-bottom: 1px solid var(--gray-100); }
.norma-content p { margin-bottom: 14px; }
.norma-content h3 { font-size: 17px; color: var(--burgundy); margin: 20px 0 8px; }

/* =============================================================
   CHECKBOX CUSTOM
   ============================================================= */
.check-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1.5px solid var(--gray-200);
  background: white;
  margin-bottom: 8px;
  transition: all var(--transition);
  cursor: pointer;
}
.check-item:hover { border-color: var(--gold); background: rgba(201,168,76,.04); }
.check-item input[type="checkbox"] { accent-color: var(--burgundy); width: 16px; height: 16px; }

/* =============================================================
   MISC UTILITIES
   ============================================================= */
.mt-0 { margin-top: 0 !important; }
.mt-4 { margin-top: 4px !important; }
.mt-8 { margin-top: 8px !important; }
.mt-16 { margin-top: 16px !important; }
.mt-24 { margin-top: 24px !important; }
.mb-16 { margin-bottom: 16px !important; }
.mb-24 { margin-bottom: 24px !important; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.text-small { font-size: 12px; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }
.w-full { width: 100%; }

@media (max-width: 900px) {
  .login-brand { display: none; }
  .main-content { margin-left: 0; }
  .sidebar { width: 0; }
}
