/* =============================================
   SISTEMA BANEXPORT — STYLESHEET PRINCIPAL
   Paleta: Verde selva + Dorado + Blanco limpio
   ============================================= */

:root {
  --green-900: #0d2b1e;
  --green-800: #1b4332;
  --green-700: #2d6a4f;
  --green-600: #40916c;
  --green-500: #52b788;
  --green-200: #b7e4c7;
  --green-100: #d8f3dc;
  --green-50:  #f0faf3;
  --gold:      #f4c430;
  --gold-dark: #d4a017;
  --gold-light:#fef3c7;
  --white:     #ffffff;
  --gray-50:   #f8fafb;
  --gray-100:  #f1f5f4;
  --gray-200:  #e2e8e5;
  --gray-300:  #c8d5ce;
  --gray-400:  #9ab5a8;
  --gray-500:  #6b8f7e;
  --gray-700:  #374b42;
  --gray-900:  #1a2820;
  --red:       #e53e3e;
  --red-light: #fff5f5;
  --blue:      #3182ce;
  --blue-light:#ebf8ff;
  --sidebar-w: 260px;
  --topbar-h:  64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.14);
  --transition: 0.22s cubic-bezier(0.4,0,0.2,1);
}

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

html { font-size: 15px; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* ─── SIDEBAR ────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--green-800);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0;
  z-index: 200;
  transition: transform var(--transition);
  box-shadow: 4px 0 24px rgba(0,0,0,0.15);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-icon {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.brand-text { display: flex; flex-direction: column; }
.brand-name {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  color: var(--white);
  font-size: 1.05rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.brand-sub {
  font-size: 0.72rem;
  color: var(--green-200);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section { margin-bottom: 20px; }

.nav-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green-200);
  padding: 0 10px;
  margin-bottom: 6px;
  opacity: 0.7;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 400;
  transition: all var(--transition);
  margin-bottom: 2px;
  position: relative;
}

.nav-item svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: var(--white);
}

.nav-item.active {
  background: var(--gold);
  color: var(--green-900);
  font-weight: 600;
}

.nav-item.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 20px;
  display: none;
}

.nav-item.active .nav-badge {
  background: rgba(0,0,0,0.15);
  color: var(--green-900);
}

.sidebar-footer {
  padding: 16px 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--green-900);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-name {
  font-size: 0.85rem;
  color: var(--white);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role { font-size: 0.72rem; color: var(--green-200); opacity: 0.7; }

.logout-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  transition: all var(--transition);
  flex-shrink: 0;
}
.logout-btn svg { width: 17px; height: 17px; }
.logout-btn:hover { background: rgba(229,62,62,0.2); color: #fc8181; }

/* ─── MAIN CONTENT ───────────────────────── */
.main-content {
  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;
  gap: 16px;
  padding: 0 28px;
  position: sticky; top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.menu-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--gray-700);
  border-radius: 2px;
  transition: var(--transition);
}

.topbar-title h1 {
  font-family: 'Fraunces', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--green-800);
  letter-spacing: -0.02em;
  flex: 1;
}

.topbar-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }

/* ─── PAGE CONTENT ───────────────────────── */
.page-content {
  padding: 28px;
  flex: 1;
}

/* ─── ALERTS ─────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  margin: 12px 28px 0;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert button {
  background: none; border: none;
  font-size: 1.3rem; cursor: pointer;
  opacity: 0.6; line-height: 1;
  padding: 0 4px;
  color: inherit;
}
.alert button:hover { opacity: 1; }

.alert-success { background: var(--green-100); color: var(--green-800); border-left: 4px solid var(--green-500); }
.alert-error   { background: var(--red-light);  color: var(--red);       border-left: 4px solid var(--red); }
.alert-warning { background: var(--gold-light);  color: #92400e;          border-left: 4px solid var(--gold); }
.alert-info    { background: var(--blue-light);  color: var(--blue);      border-left: 4px solid var(--blue); }

/* ─── CARDS ──────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

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

.card-header h2 {
  font-family: 'Fraunces', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--green-800);
}

.card-body { padding: 24px; }

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

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
}

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

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

.stat-icon.green  { background: var(--green-100); }
.stat-icon.gold   { background: var(--gold-light); }
.stat-icon.blue   { background: var(--blue-light); }

.stat-info { display: flex; flex-direction: column; }
.stat-number {
  font-family: 'Fraunces', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--green-800);
  line-height: 1;
  letter-spacing: -0.03em;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--gray-500);
  font-weight: 500;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── BUTTONS ────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: var(--green-700);
  color: var(--white);
}
.btn-primary:hover { background: var(--green-600); box-shadow: 0 4px 12px rgba(64,145,108,0.35); }

.btn-gold {
  background: var(--gold);
  color: var(--green-900);
  font-weight: 600;
}
.btn-gold:hover { background: var(--gold-dark); }

.btn-outline {
  background: transparent;
  color: var(--green-700);
  border: 1.5px solid var(--green-700);
}
.btn-outline:hover { background: var(--green-50); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1.5px solid var(--red);
}
.btn-danger:hover { background: var(--red-light); }

.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

/* ─── FORMS ──────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-700);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: 'DM Sans', sans-serif;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(82,183,136,0.15);
}

textarea { resize: vertical; min-height: 90px; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b8f7e' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-100);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-top: 3px;
}

/* ─── TABLE ──────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead th {
  background: var(--green-800);
  color: var(--white);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--green-50); }

td {
  padding: 13px 16px;
  color: var(--gray-700);
  vertical-align: middle;
}

td.td-name {
  font-weight: 600;
  color: var(--green-800);
}

td.td-actions {
  white-space: nowrap;
  text-align: right;
}

td.td-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ─── BADGES / STATUS ────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge-active   { background: var(--green-100); color: var(--green-800); }
.badge-inactive { background: var(--gray-100);  color: var(--gray-500); }

/* ─── SEARCH BAR ─────────────────────────── */
.search-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-input-wrapper svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--gray-400);
  pointer-events: none;
}

.search-input-wrapper input {
  padding-left: 38px;
}

/* ─── MODAL ──────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}

.modal-overlay.show { display: flex; }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.88) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.1rem;
  color: var(--green-800);
}

.modal-close {
  background: none; border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--gray-400);
  line-height: 1;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--red); }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ─── EMPTY STATE ────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}

.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.3rem;
  color: var(--gray-500);
  margin-bottom: 8px;
}
.empty-state p { font-size: 0.9rem; margin-bottom: 20px; }

/* ─── PAGINATION ─────────────────────────── */
.pagination-nav { margin-top: 20px; }
.pagination {
  display: flex;
  list-style: none;
  gap: 4px;
  flex-wrap: wrap;
}

.page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--green-700);
  text-decoration: none;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  transition: all var(--transition);
}

.page-item.active .page-link {
  background: var(--green-700);
  color: var(--white);
  border-color: var(--green-700);
}

.page-link:hover:not(.active) {
  background: var(--green-50);
  border-color: var(--green-500);
}

/* ─── LOGIN PAGE ─────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--green-800);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(82,183,136,0.18) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(244,196,48,0.10) 0%, transparent 50%);
  padding: 20px;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.login-header {
  background: var(--green-800);
  padding: 36px 36px 28px;
  text-align: center;
}

.login-logo {
  font-size: 3rem;
  margin-bottom: 12px;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.login-title {
  font-family: 'Fraunces', serif;
  font-size: 1.6rem;
  color: var(--white);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 0.82rem;
  color: var(--green-200);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.75;
}

.login-body { padding: 32px 36px 36px; }

.login-body .form-group { margin-bottom: 16px; }

.login-body label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 7px;
}

.input-icon-wrapper {
  position: relative;
}

.input-icon-wrapper svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--gray-300);
  pointer-events: none;
}

.input-icon-wrapper input { padding-left: 40px; }

.btn-login {
  width: 100%;
  padding: 13px;
  background: var(--green-700);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
  letter-spacing: 0.02em;
}

.btn-login:hover {
  background: var(--green-600);
  box-shadow: 0 6px 20px rgba(64,145,108,0.4);
  transform: translateY(-1px);
}

.login-links {
  text-align: center;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--gray-400);
}

.login-links a {
  color: var(--green-600);
  text-decoration: none;
  font-weight: 500;
}

.login-links a:hover { text-decoration: underline; }

.login-error {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid rgba(229,62,62,0.2);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 0.88rem;
  margin-bottom: 18px;
  text-align: center;
}

/* ─── DETAIL ROWS ────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
}

.detail-item { display: flex; flex-direction: column; gap: 4px; }
.detail-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.detail-value {
  font-size: 0.95rem;
  color: var(--gray-700);
  font-weight: 500;
}

/* ─── RESPONSIVE ─────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
  }

  .page-content {
    padding: 16px;
  }

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

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

  .topbar { padding: 0 16px; }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
  }
  .sidebar-overlay.show { display: block; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-body { padding: 24px; }
  .login-header { padding: 28px 24px 20px; }
}
