/* ============================================================
   MPCS Soluciones · Portal del Empleado (mi.mpcs.pe)
   style.css
   ============================================================ */

:root {
  --navy:        #1B2B5E;
  --navy-dark:   #132044;
  --navy-mid:    #243672;
  --navy-light:  #EEF2FB;
  --accent:      #2E4DB0;
  --text:        #1a1a2e;
  --text-muted:  #6b7280;
  --border:      rgba(0,0,0,0.08);
  --border-md:   rgba(0,0,0,0.14);
  --bg:          #f4f6fb;
  --white:       #ffffff;
  --success:     #059669;
  --success-bg:  #D1FAE5;
  --warning:     #D97706;
  --warning-bg:  #FEF3C7;
  --error:       #DC2626;
  --error-bg:    #FEE2E2;
  --info:        #2563EB;
  --info-bg:     #DBEAFE;
  --sidebar-w:   220px;
  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:   0 8px 24px rgba(0,0,0,0.10);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px; color: var(--text);
  background: var(--bg); line-height: 1.6; min-height: 100vh;
}

/* ── LOGIN ── */
.page-login {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 2rem 1rem;
  background: linear-gradient(135deg, #0f1729 0%, #1B2B5E 50%, #243672 100%);
}
.login-container { width: 100%; max-width: 400px; }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-logo { display: inline-flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.login-logo .mi   { font-size: 36px; font-weight: 800; color: #fff; letter-spacing: -2px; }
.login-logo .mpcs { font-size: 16px; font-weight: 400; color: rgba(255,255,255,0.6); }
.login-tagline    { font-size: 13px; color: rgba(255,255,255,0.45); letter-spacing: 0.05em; text-transform: uppercase; }
.login-card {
  background: var(--white); border-radius: var(--radius-xl);
  padding: 2rem; box-shadow: 0 24px 48px rgba(0,0,0,0.3);
}
.login-card h2  { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.login-card .sub { font-size: 13px; color: var(--text-muted); margin-bottom: 1.5rem; }
.login-footer { text-align: center; margin-top: 1.25rem; font-size: 12px; color: rgba(255,255,255,0.35); }

/* ── LAYOUT ── */
.portal-layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w); background: var(--navy);
  position: fixed; top: 0; left: 0; height: 100vh;
  display: flex; flex-direction: column; z-index: 100;
}
.sidebar-header { padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo { display: flex; align-items: baseline; gap: 6px; }
.sidebar-logo .mi   { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: -1px; }
.sidebar-logo .mpcs { font-size: 12px; color: rgba(255,255,255,0.5); font-weight: 400; }
.sidebar-tagline { font-size: 11px; color: rgba(255,255,255,0.3); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.nav-section { padding: 0 0.75rem; margin-bottom: 0.5rem; }
.nav-section-label { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255,255,255,0.3); padding: 0.5rem 0.5rem 0.25rem; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-md);
  color: rgba(255,255,255,0.65); font-size: 13px;
  text-decoration: none; cursor: pointer; transition: all 0.15s;
  margin-bottom: 2px; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover  { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.12); color: #fff; font-weight: 500; }
.nav-item svg    { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer { padding: 1rem 0.75rem; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-md); }
.sidebar-avatar { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: #fff; flex-shrink: 0; overflow: hidden; }
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 500; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,0.4); }
.sidebar-logout { background: none; border: none; cursor: pointer; color: rgba(255,255,255,0.4); padding: 4px; border-radius: var(--radius-sm); transition: color 0.15s; }
.sidebar-logout:hover { color: #fff; }

/* ── MAIN ── */
.main-content { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }
.page-header { background: var(--white); padding: 1.25rem 2rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.page-header h1 { font-size: 18px; font-weight: 600; }
.page-header p  { font-size: 13px; color: var(--text-muted); margin-top: 1px; }
.page-body { padding: 1.75rem 2rem; flex: 1; }

/* ── CARDS ── */
.card { background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h2 { font-size: 14px; font-weight: 600; }
.card-body { padding: 1.25rem; }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 1.75rem; }
.stat-card { background: var(--white); border-radius: var(--radius-lg); padding: 1.25rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── BOTONES ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; padding: 8px 16px;
  border-radius: var(--radius-md); cursor: pointer;
  border: 1px solid var(--border-md); background: var(--white); color: var(--text);
  transition: all 0.15s; text-decoration: none;
}
.btn:hover  { background: var(--bg); }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-dark); }
.btn-sm { font-size: 12px; padding: 5px 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn-ghost { border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn:disabled { opacity: 0.6; cursor: default; }

/* ── FORMULARIOS ── */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.04em; }
.field input, .field select, .field textarea { width: 100%; font-size: 13px; padding: 8px 10px; border: 1px solid var(--border-md); border-radius: var(--radius-md); background: var(--white); color: var(--text); outline: none; transition: border-color 0.15s; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46,77,176,0.1); }
.field textarea { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field.full { grid-column: 1 / -1; }
.req { color: var(--error); }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 20px; }
.badge-blue   { background: var(--navy-light); color: var(--navy); }
.badge-green  { background: var(--success-bg); color: var(--success); }
.badge-yellow { background: var(--warning-bg); color: var(--warning); }
.badge-red    { background: var(--error-bg);   color: var(--error); }
.badge-gray   { background: #F3F4F6; color: #6B7280; }

/* ── ALERTS ── */
.alert { font-size: 13px; padding: 10px 14px; border-radius: var(--radius-md); margin-bottom: 1rem; }
.alert-error   { background: var(--error-bg);   color: var(--error);   border: 1px solid rgba(220,38,38,0.2); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(5,150,105,0.2); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border: 1px solid rgba(37,99,235,0.2); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(217,119,6,0.2); }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 1rem; }
.modal-overlay.hidden { display: none; }
.modal { background: var(--white); border-radius: var(--radius-xl); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--white); z-index: 1; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; border-radius: var(--radius-sm); font-size: 18px; line-height: 1; }
.modal-close:hover { color: var(--text); background: var(--bg); }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ── TABLA ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
tbody tr:hover { background: var(--bg); }
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }

/* ── EMPTY / LOADING ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state p { font-size: 13px; }
.loading { display: flex; align-items: center; justify-content: center; padding: 3rem; color: var(--text-muted); gap: 10px; font-size: 13px; }

/* ── UPLOAD ── */
.upload-area { border: 2px dashed var(--border-md); border-radius: var(--radius-lg); padding: 1.5rem; text-align: center; cursor: pointer; transition: all 0.2s; }
.upload-area:hover { border-color: var(--navy); background: var(--navy-light); }
.upload-area input { display: none; }
.upload-area p { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* ── DATOS READONLY ── */
.dato-field { margin-bottom: 1rem; }
.dato-field .dato-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 3px; }
.dato-field .dato-value { font-size: 14px; font-weight: 500; color: var(--text); }

/* ── FIRST LOGIN BANNER ── */
.first-login-banner { background: var(--warning-bg); border: 1px solid rgba(217,119,6,0.3); border-radius: var(--radius-lg); padding: 1rem 1.25rem; margin-bottom: 1.5rem; display: flex; align-items: center; gap: 12px; }
.first-login-banner p { font-size: 13px; color: var(--warning); }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr; }
  .page-body { padding: 1rem; }
  .form-grid { grid-template-columns: 1fr; }
}
