/* ===================== PLATAFORMA (APP) STYLES ===================== */

/* ---- LAYOUT ---- */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--gray-soft);
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--gray-100);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform var(--ease-mid);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--gray-100);
}

.sidebar-logo {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--green-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--green-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar-nav-section { margin-bottom: 24px; }
.sidebar-nav-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-light);
  padding: 0 8px; margin-bottom: 8px;
}

.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-md);
  color: var(--text-muted); font-size: 0.9rem; font-weight: 500;
  transition: all var(--ease-fast); margin-bottom: 2px;
}
.sidebar-nav a:hover { color: var(--green-primary); background: var(--green-soft); }
.sidebar-nav a.active { color: var(--green-primary); background: var(--green-soft); font-weight: 600; }
.sidebar-nav a.active .nav-icon { color: var(--green-primary); }
.nav-icon { font-size: 1.1rem; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--green-primary);
  color: var(--white);
  font-size: 0.7rem; font-weight: 700;
  padding: 2px 7px; border-radius: var(--radius-full);
  min-width: 20px; text-align: center;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--gray-100);
}

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-md);
  cursor: pointer; transition: background var(--ease-fast);
}
.sidebar-user:hover { background: var(--gray-soft); }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--green-grad);
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.875rem; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-plan { font-size: 0.75rem; color: var(--text-muted); }

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

/* ---- TOP BAR ---- */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-100);
  padding: 0 28px;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.page-title { font-family: var(--font-head); font-size: 1.2rem; font-weight: 700; color: var(--text-main); }
.breadcrumb { font-size: 0.8rem; color: var(--text-muted); }

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

.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 1.1rem;
  transition: all var(--ease-fast); position: relative;
  background: transparent;
}
.icon-btn:hover { background: var(--gray-soft); color: var(--green-primary); }
.icon-btn .badge-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-red);
  border: 2px solid var(--white);
}

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

/* ---- WIDGET GRID ---- */
.widgets-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }

.widget-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--gray-100);
  transition: all var(--ease-mid);
}
.widget-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.widget-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.widget-label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.widget-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.widget-icon.green { background: var(--green-soft); }
.widget-icon.blue  { background: #EFF4FF; }
.widget-icon.gold  { background: #FEF8E1; }
.widget-icon.red   { background: #FFF0F0; }

.widget-value { font-family: var(--font-head); font-size: 1.8rem; font-weight: 800; color: var(--text-main); line-height: 1; margin-bottom: 6px; }
.widget-change { font-size: 0.78rem; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.widget-change.up   { color: var(--green-primary); }
.widget-change.down { color: var(--accent-red); }

/* ---- TABLES ---- */
.table-card { background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--gray-100); overflow: hidden; }
.table-header { padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--gray-100); }
.table-title { font-family: var(--font-head); font-weight: 700; font-size: 1rem; color: var(--text-main); }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 16px; text-align: left; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--gray-100); background: var(--gray-soft); }
.data-table td { padding: 14px 16px; font-size: 0.875rem; color: var(--text-main); border-bottom: 1px solid var(--gray-100); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--ease-fast); }
.data-table tbody tr:hover { background: var(--gray-soft); }

/* ---- STATUS PILLS ---- */
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 0.75rem; font-weight: 600;
}
.status-pill.transit  { background: #EFF4FF; color: var(--accent-blue); }
.status-pill.aduana   { background: #FEF8E1; color: #8C6A00; }
.status-pill.entregado { background: var(--green-soft); color: var(--green-dark); }
.status-pill.pendiente { background: #FFF0F0; color: var(--accent-red); }
.status-dot-sm { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---- CONTENT GRID ---- */
.content-grid { display: grid; grid-template-columns: 1fr 360px; gap: 20px; }
.content-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ---- CALCULADORA ---- */
.calc-result {
  background: var(--green-soft);
  border: 1.5px solid var(--green-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 16px;
}
.calc-result-title { font-family: var(--font-head); font-size: 0.85rem; font-weight: 700; color: var(--green-dark); margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.06em; }
.calc-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(46,125,86,0.15); font-size: 0.875rem; }
.calc-row:last-child { border-bottom: none; }
.calc-row.total { font-weight: 800; font-size: 1.1rem; color: var(--green-primary); padding-top: 12px; margin-top: 4px; border-top: 2px solid var(--green-primary); border-bottom: none; }
.calc-label { color: var(--text-mid); }
.calc-value { font-weight: 600; color: var(--text-main); }

/* ---- PROGRESS BARS ---- */
.progress-bar {
  height: 8px; border-radius: var(--radius-full);
  background: var(--gray-100); overflow: hidden; margin-top: 6px;
}
.progress-fill {
  height: 100%; border-radius: var(--radius-full);
  background: var(--green-grad); transition: width 0.8s ease;
}

/* ---- TIMELINE ---- */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 16px; position: relative; }
.timeline-item:not(:last-child)::before { content: ''; position: absolute; left: 15px; top: 32px; bottom: -8px; width: 2px; background: var(--gray-200); }
.timeline-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; background: var(--green-soft); border: 2px solid var(--green-light); z-index: 1; }
.timeline-icon.done { background: var(--green-primary); border-color: var(--green-primary); color: var(--white); }
.timeline-body { flex: 1; padding: 0 0 20px; }
.timeline-title { font-weight: 600; font-size: 0.875rem; color: var(--text-main); margin-bottom: 2px; }
.timeline-meta  { font-size: 0.78rem; color: var(--text-muted); }

/* ---- PROVIDER CARD ---- */
.provider-card { background: var(--white); border-radius: var(--radius-lg); padding: 24px; border: 1.5px solid var(--gray-100); transition: all var(--ease-mid); }
.provider-card:hover { border-color: var(--green-light); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.provider-top { display: flex; gap: 14px; margin-bottom: 14px; }
.provider-logo { width: 52px; height: 52px; border-radius: 14px; background: var(--green-grad); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.provider-name { font-family: var(--font-head); font-weight: 700; font-size: 1rem; color: var(--text-main); }
.provider-country { font-size: 0.8rem; color: var(--text-muted); }
.provider-rating { display: flex; align-items: center; gap: 4px; font-size: 0.8rem; font-weight: 600; color: var(--text-main); margin-top: 2px; }
.star-filled { color: #F4C430; }
.provider-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tag { background: var(--gray-100); color: var(--text-muted); font-size: 0.75rem; padding: 3px 10px; border-radius: var(--radius-full); font-weight: 500; }

/* ---- LOGIN ---- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-visual { background: var(--green-grad); display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 48px; text-align: center; position: relative; overflow: hidden; }
.auth-visual::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px); background-size: 40px 40px; }
.auth-visual-content { position: relative; z-index: 1; }
.auth-visual h2 { font-family: var(--font-head); font-size: 2.2rem; font-weight: 800; color: var(--white); margin-bottom: 16px; }
.auth-visual p { font-size: 1rem; color: rgba(255,255,255,0.75); line-height: 1.7; max-width: 340px; }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 48px; background: var(--white); }
.auth-form-wrap { width: 100%; max-width: 420px; }
.auth-logo { font-family: var(--font-head); font-weight: 800; font-size: 1.6rem; color: var(--green-primary); margin-bottom: 32px; }
.auth-title { font-family: var(--font-head); font-size: 1.8rem; font-weight: 800; color: var(--text-main); margin-bottom: 6px; }
.auth-sub { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 28px; }
.auth-tabs { display: flex; border-radius: var(--radius-md); background: var(--gray-soft); padding: 4px; margin-bottom: 28px; }
.auth-tab { flex: 1; padding: 8px; text-align: center; font-size: 0.875rem; font-weight: 600; color: var(--text-muted); border-radius: calc(var(--radius-md) - 2px); cursor: pointer; transition: all var(--ease-fast); }
.auth-tab.active { background: var(--white); color: var(--green-primary); box-shadow: var(--shadow-xs); }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 4px 0; }
.auth-divider span { font-size: 0.8rem; color: var(--text-light); white-space: nowrap; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--gray-200); }
.auth-submit { width: 100%; justify-content: center; }
.auth-msg {
  padding: 10px 14px; border-radius: var(--radius-md);
  font-size: 0.85rem; font-weight: 500; line-height: 1.5;
}
.auth-msg.error   { background: #FFF0F0; color: #C0392B; border: 1px solid #F5C6C6; }
.auth-msg.success { background: var(--green-soft); color: var(--green-dark); border: 1px solid var(--green-light); }
.auth-msg.info    { background: #EFF4FF; color: var(--accent-blue); border: 1px solid #BDD3F8; }

/* ---- RESPONSIVE PLATAFORMA ---- */
@media (max-width: 1024px) {
  .widgets-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .widgets-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
}
@media (max-width: 480px) {
  .widgets-grid { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}

/* ===================== MEJORAS VISUALES ===================== */

/* Entrada animada del contenido */
.page-content { animation: fadeInPage .35s ease both; }
@keyframes fadeInPage {
  from { opacity:0; transform:translateY(10px); }
  to   { opacity:1; transform:translateY(0); }
}

/* Sidebar — link activo más visible */
.sidebar-nav a.active {
  background: linear-gradient(135deg, var(--green-soft), #d0edd9);
  color: var(--green-dark);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--green-primary);
}
.sidebar-nav a:hover {
  background: var(--green-soft);
  color: var(--green-dark);
  transform: translateX(2px);
}

/* Widget cards — gradiente sutil en hover */
.widget-card:hover {
  box-shadow: 0 8px 28px rgba(46,125,86,.14);
  transform: translateY(-3px);
  border-color: rgba(76,175,125,.3);
}
.widget-icon.green { background: linear-gradient(135deg,#E8F5EE,#d0edd9); }
.widget-icon.blue  { background: linear-gradient(135deg,#EFF4FF,#dae7fb); }
.widget-icon.gold  { background: linear-gradient(135deg,#FEF8E1,#faefc1); }
.widget-icon.red   { background: linear-gradient(135deg,#FFF0F0,#fdd9d9); }

/* Topbar — sombra al hacer scroll */
.topbar {
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,.97);
}

/* Table hover más suave */
.data-table tbody tr:hover {
  background: linear-gradient(90deg, var(--green-soft) 0%, transparent 100%);
}

/* Skeleton loader */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg,#EEF2EF 25%,#e0e8e3 50%,#EEF2EF 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}

/* Toast de notificación */
.toast-msg {
  position: fixed; bottom: 90px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg,#1A4D35,#2E7D56);
  color: #fff; padding: 14px 24px; border-radius: 14px;
  font-size: .875rem; font-weight: 600;
  box-shadow: 0 6px 24px rgba(46,125,86,.4);
  z-index: 9997; opacity: 0;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none; white-space: nowrap;
}
.toast-msg.show {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* Status pills — animación de punto */
.status-dot-sm {
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.6; transform:scale(1.4); }
}

/* Proveedor card — borde gradiente en hover */
.provider-card:hover {
  border-color: var(--green-primary);
  box-shadow: 0 8px 32px rgba(46,125,86,.16);
}

/* Botones — feedback táctil */
.btn-primary:active  { transform: scale(.97); }
.btn-secondary:active { transform: scale(.97); }
