/* ==========================================================================
   PORTS DE BALEARS (APB) - SYSTEM DESIGN SYSTEM & STYLESHEET
   Inspirado en la imagen corporativa oficial de https://www.portsdebalears.com
   ========================================================================== */

:root {
  /* PALETA CORPORATIVA APB - PORTS DE BALEARS */
  --primary: #002855;             /* Azul Noche Corporativo APB */
  --primary-hover: #001937;
  --secondary: #0072ce;           /* Azul Marítimo APB */
  --secondary-hover: #005aa3;
  --accent: #e5a93c;              /* Dorado / Ámbar Institucional APB */
  --accent-hover: #cc9127;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* TEMA OSCURO CORPORATIVO */
  --bg-dark: #071325;
  --bg-card-dark: #0f2442;
  --text-dark: #f1f5f9;

  /* TEMA CLARO CORPORATIVO (PORTS DE BALEARS DEFAULT) */
  --bg-light: #f3f6fa;
  --bg-card-light: #ffffff;
  --text-light: #0b1727;
  --border-light: #d1dbe8;
  --border-dark: #1e3a66;
  
  --radius: 10px;
  --shadow: 0 8px 25px -4px rgba(0, 40, 85, 0.08), 0 3px 8px -2px rgba(0, 40, 85, 0.04);
  --shadow-hover: 0 14px 30px -4px rgba(0, 40, 85, 0.15), 0 6px 12px -2px rgba(0, 40, 85, 0.08);
  --transition: all 0.22s ease-in-out;
}

body.dark-mode {
  --bg-main: var(--bg-dark);
  --bg-card: var(--bg-card-dark);
  --text-main: var(--text-dark);
  --border-color: var(--border-dark);
  --input-bg: #071325;
  --subnav-btn-bg: #1e3a66;
  --subnav-btn-text: #f1f5f9;
}

body.light-mode {
  --bg-main: var(--bg-light);
  --bg-card: var(--bg-card-light);
  --text-main: var(--text-light);
  --border-color: var(--border-light);
  --input-bg: #ffffff;
  --subnav-btn-bg: #eef4fc;
  --subnav-btn-text: #002855;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

/* ==========================================
   NAVBAR CORPORATIVO PORTS DE BALEARS
   ========================================== */
.navbar {
  background: linear-gradient(135deg, #001735 0%, #002855 60%, #003e78 100%);
  border-bottom: 4px solid var(--accent);
  color: white;
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 25px rgba(0, 30, 70, 0.3);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* CONTENEDOR BLANCO PARA EL LOGO OFICIAL APB PORTS DE BALEARS */
.brand-logo-card {
  background: #ffffff;
  padding: 6px 14px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.9);
  transition: var(--transition);
}

.brand-logo-card:hover {
  transform: scale(1.02);
}

.brand-logo-img {
  height: 44px;
  width: auto;
  object-fit: contain;
}

.brand-title-group {
  display: flex;
  flex-direction: column;
}

.brand-title-main {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
  line-height: 1.15;
}

.brand-title-sub {
  font-size: 0.76rem;
  color: #cbd5e1;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.brand-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #002855;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-tabs {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  padding: 5px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff !important;
  padding: 8px 18px;
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.9;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.25) !important;
  opacity: 1;
}

.nav-btn.active {
  background: #ffffff !important;
  color: var(--primary) !important;
  opacity: 1;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

/* SUB-NAVEGACIÓN DEL BACKOFFICE PORTS DE BALEARS */
.subnav-container {
  display: flex !important;
  gap: 10px !important;
  margin-bottom: 1.75rem !important;
  border-bottom: 2px solid var(--border-color) !important;
  padding-bottom: 0.85rem !important;
  flex-wrap: wrap !important;
}

.subnav-btn {
  background-color: var(--subnav-btn-bg) !important;
  color: var(--subnav-btn-text) !important;
  border: 1px solid var(--border-color) !important;
  padding: 10px 20px !important;
  border-radius: 8px !important;
  font-size: 0.92rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 0.2s ease-in-out !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  box-shadow: 0 2px 6px rgba(0, 40, 85, 0.06) !important;
}

.subnav-btn:hover {
  background-color: #d1dbe8 !important;
  color: var(--primary) !important;
}

.subnav-btn.active {
  background: linear-gradient(135deg, var(--primary), #001937) !important;
  color: #ffffff !important;
  border-color: #001937 !important;
  box-shadow: 0 4px 14px rgba(0, 40, 85, 0.3) !important;
}

.role-pill {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.role-select {
  background: transparent;
  color: white;
  border: none;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.role-select option {
  background: var(--bg-card-dark);
  color: white;
}

/* ==========================================
   ESTRUCTURA DE CONTENEDOR Y TARJETAS
   ========================================== */
.container {
  max-width: 1420px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  width: 100%;
  flex: 1;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
}

body.dark-mode .card-title {
  color: #38bdf8;
}

/* ==========================================
   FORMULARIO Y ENTRADAS CORPORATIVAS
   ========================================== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-main);
}

.form-help {
  font-size: 0.82rem;
  color: #64748b;
  margin-bottom: 0.5rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(0, 114, 206, 0.18);
}

textarea.form-control {
  resize: vertical;
  min-height: 105px;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-box {
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  padding: 0.9rem 1.15rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: var(--transition);
}

.option-box:hover {
  border-color: var(--secondary);
  background: rgba(0, 114, 206, 0.04);
}

.option-box.selected {
  border-color: var(--primary);
  background: rgba(0, 40, 85, 0.07);
  box-shadow: 0 0 0 2px var(--primary);
}

.option-radio {
  margin-top: 3px;
  accent-color: var(--primary);
}

/* ==========================================
   BOTONES Y ELEMENTOS DE ACCIÓN PORTS DE BALEARS
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.65rem 1.35rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #001937);
  color: white;
  box-shadow: 0 3px 10px rgba(0, 40, 85, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #001937, #000f24);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 40, 85, 0.35);
}

.btn-secondary {
  background: var(--subnav-btn-bg);
  color: var(--subnav-btn-text);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #d1dbe8;
  color: var(--primary);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-enviado { background: #e0f2fe; color: #0369a1; }
.badge-evaluacion { background: #fef3c7; color: #b45309; }
.badge-evaluado { background: #dcfce7; color: #15803d; }
.badge-aprobado { background: #d1fae5; color: #047857; }
.badge-rechazado { background: #fee2e2; color: #b91c1c; }

/* PESTAÑAS INTERNAS DE DETALLE DE PROYECTO */
.tabs-header {
  display: flex;
  gap: 10px;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.tab-link {
  padding: 0.75rem 1.5rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: var(--transition);
}

.tab-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

body.dark-mode .tab-link.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
}

/* GRID DE MÉTRICAS */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background: rgba(0, 40, 85, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
}

.metric-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary);
  margin: 4px 0;
}

body.dark-mode .metric-value {
  color: #38bdf8;
}

.metric-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
}

/* TABLA DE DATOS CORPORATIVA PORTS DE BALEARS */
.table-responsive {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

table.data-table th, table.data-table td {
  padding: 0.9rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

table.data-table th {
  background: rgba(0, 40, 85, 0.06);
  color: var(--primary);
  font-weight: 800;
}

.chart-container {
  position: relative;
  height: 450px;
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
}

.timeline {
  position: relative;
  padding-left: 2rem;
  margin-top: 1.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--primary);
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
}

.timeline-icon {
  position: absolute;
  left: -2rem;
  top: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid var(--bg-card);
}

.timeline-content {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
}

.superset-frame {
  width: 100%;
  height: 700px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

/* ==========================================
   FOOTER CORPORATIVO PORTS DE BALEARS
   ========================================== */
footer {
  background: linear-gradient(135deg, #001229 0%, #001b3a 100%);
  color: #cbd5e1;
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.88rem;
  border-top: 4px solid var(--secondary);
}
