/* ============================================================
   ITEAF Gestor — Hoja de estilos principal v1.0
   ============================================================ */

:root {
  --green-900: #0f2d0f;
  --green-800: #1b4332;
  --green-700: #2d6a4f;
  --green-600: #40916c;
  --green-500: #52b788;
  --green-400: #74c69d;
  --green-100: #d8f3dc;
  --green-50:  #f0faf2;

  --white:     #ffffff;
  --gray-50:   #f8fafb;
  --gray-100:  #f1f3f5;
  --gray-200:  #e9ecef;
  --gray-400:  #adb5bd;
  --gray-600:  #6c757d;
  --gray-800:  #343a40;
  --gray-900:  #212529;

  --red-500:   #e03131;
  --amber-500: #f59f00;
  --blue-500:  #228be6;

  --shadow-sm: 0 1px 4px rgba(0,0,0,.08);
  --shadow:    0 4px 20px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.18);

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;

  --sidebar-w: 260px;
  --topbar-h:  64px;
  --transition: .25s ease;

  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  font-size: 15px;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.5;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 60%, rgba(64,145,108,.35) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 20%, rgba(45,106,79,.4) 0%, transparent 50%),
    linear-gradient(135deg, #0f2d0f 0%, #1b4332 40%, #2d6a4f 100%);
  padding: 24px;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  animation: slideUp .45s cubic-bezier(.22,1,.36,1) both;
}

@keyframes slideUp {
  from { opacity:0; transform:translateY(28px); }
  to   { opacity:1; transform:translateY(0); }
}

.login-header {
  background: linear-gradient(135deg, #0f2d0f 0%, #2d6a4f 100%);
  padding: 36px 40px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.login-logo {
  width: 200px;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.4));
}

.login-subtitle {
  color: rgba(255,255,255,.75);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
}

.login-body-content {
  padding: 36px 40px 40px;
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--green-800);
  margin-bottom: 6px;
}

.login-desc {
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: 28px;
}

/* Form */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font);
  color: var(--gray-900);
  background: var(--gray-50);
  transition: var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--green-600);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(64,145,108,.15);
}

.form-input::placeholder { color: var(--gray-400); }

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 16px;
  pointer-events: none;
}

.input-wrapper .form-input {
  padding-left: 42px;
}

.btn-login {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--green-700) 0%, var(--green-600) 100%);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: .5px;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-login:hover {
  background: linear-gradient(135deg, var(--green-800) 0%, var(--green-700) 100%);
  box-shadow: 0 4px 16px rgba(45,106,79,.4);
  transform: translateY(-1px);
}

.btn-login:active { transform: translateY(0); }

.alert-error {
  background: #fff5f5;
  border: 1.5px solid #ffc9c9;
  border-radius: var(--radius-sm);
  color: var(--red-500);
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  animation: shake .4s ease;
}

@keyframes shake {
  0%,100%{transform:translateX(0)}
  20%{transform:translateX(-5px)}
  40%{transform:translateX(5px)}
  60%{transform:translateX(-4px)}
  80%{transform:translateX(4px)}
}

.login-footer {
  border-top: 1px solid var(--gray-100);
  padding: 14px 40px;
  text-align: center;
  font-size: 12px;
  color: var(--gray-400);
}

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */

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

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--green-900) 0%, #1a3a1a 100%);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo {
  width: 100%;
  max-width: 200px;
  filter: brightness(0) invert(1) drop-shadow(0 2px 6px rgba(0,0,0,.3));
}

.sidebar-nav {
  padding: 16px 0;
  flex: 1;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  padding: 16px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,.75);
  transition: var(--transition);
  border-left: 3px solid transparent;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: var(--white);
  border-left-color: var(--green-400);
}

.nav-item.active {
  background: rgba(116,198,157,.15);
  color: var(--white);
  border-left-color: var(--green-400);
}

.nav-item i {
  font-size: 18px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  opacity: .85;
}

.nav-badge {
  margin-left: auto;
  background: var(--green-500);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-500), var(--green-600));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.user-detail .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.user-detail .role {
  font-size: 11px;
  color: rgba(255,255,255,.45);
}

.btn-logout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: rgba(224,49,49,.15);
  border: 1px solid rgba(224,49,49,.25);
  border-radius: var(--radius-sm);
  color: #ff8787;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.btn-logout:hover {
  background: rgba(224,49,49,.28);
  color: #ffa8a8;
}

/* --- Main area --- */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Topbar --- */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-left h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
}

.topbar-left p {
  font-size: 12px;
  color: var(--gray-600);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-date {
  font-size: 13px;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--green-50);
  border: 1px solid var(--green-100);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--green-700);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-500);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,100%{opacity:1;transform:scale(1)}
  50%{opacity:.6;transform:scale(1.2)}
}

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

/* --- Welcome banner --- */
.welcome-banner {
  background: linear-gradient(135deg, var(--green-800) 0%, var(--green-700) 60%, var(--green-600) 100%);
  border-radius: var(--radius);
  padding: 28px 32px;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.welcome-banner::before {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
}

.welcome-banner::after {
  content: '';
  position: absolute;
  right: 60px;
  bottom: -60px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}

.welcome-text h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.welcome-text p {
  font-size: 14px;
  opacity: .8;
}

.welcome-icon {
  font-size: 56px;
  opacity: .25;
  z-index: 1;
}

/* --- Stats grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.green  { background: var(--green-100); color: var(--green-700); }
.stat-icon.blue   { background: #dbe4ff; color: #3b5bdb; }
.stat-icon.amber  { background: #fff3bf; color: #e67700; }
.stat-icon.red    { background: #ffe3e3; color: var(--red-500); }

.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--gray-600);
  font-weight: 500;
}

.stat-trend {
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.stat-trend.up   { color: var(--green-600); }
.stat-trend.down { color: var(--red-500); }

/* --- Cards grid --- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title i { color: var(--green-600); }

.panel-body { padding: 20px 24px; }

.panel-link {
  font-size: 12px;
  color: var(--green-600);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}
.panel-link:hover { color: var(--green-800); }

/* --- Module cards --- */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.module-card {
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.module-card:hover {
  border-color: var(--green-500);
  background: var(--green-50);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.module-card i {
  font-size: 32px;
  color: var(--green-600);
  transition: var(--transition);
}

.module-card:hover i { color: var(--green-700); transform: scale(1.1); }

.module-card .module-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-800);
}

.module-card .module-desc {
  font-size: 11px;
  color: var(--gray-600);
}

.coming-soon {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: var(--green-100);
  color: var(--green-700);
  padding: 2px 8px;
  border-radius: 20px;
}

/* --- Activity list --- */
.activity-list { list-style: none; }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

.activity-dot.green { background: var(--green-100); color: var(--green-700); }
.activity-dot.blue  { background: #dbe4ff; color: #3b5bdb; }
.activity-dot.amber { background: #fff3bf; color: #e67700; }

.activity-text { flex: 1; }
.activity-text strong { font-size: 13px; color: var(--gray-900); }
.activity-text p { font-size: 12px; color: var(--gray-600); margin-top: 1px; }
.activity-time { font-size: 11px; color: var(--gray-400); white-space: nowrap; margin-top: 3px; }

/* --- Setup notice --- */
.setup-notice {
  background: linear-gradient(135deg, #fff3bf, #fff9db);
  border: 1.5px solid #ffd43b;
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
}

.setup-notice i { font-size: 22px; color: #e67700; flex-shrink: 0; margin-top: 2px; }
.setup-notice h4 { font-size: 14px; font-weight: 700; color: #7c4a00; margin-bottom: 4px; }
.setup-notice p  { font-size: 13px; color: #8a6000; }

/* --- Footer --- */
.page-footer {
  padding: 16px 32px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--gray-400);
  background: var(--white);
}
