/**
 * GCC Bridge Console — Component Library
 * Reusable UI building blocks with console aesthetic.
 */

/* ==========================================
   CARDS / PANELS
   ========================================== */

.card {
  background: var(--surface-raised);
  border: var(--border-panel);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  transition: border-color var(--t-base) var(--ease-out);
}
.card:hover { border-color: rgba(59, 158, 206, 0.25); }

.card-header {
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-4);
  border-bottom: var(--border-subtle);
}
.card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-bright);
  margin: 0;
}

.card-body {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: var(--text-sm);
}

.card-footer {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}


/* ==========================================
   BADGES
   ========================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-mono);
}

.badge-primary { background: var(--accent-ghost); color: var(--accent); border: 1px solid var(--accent-dim); }
.badge-success { background: var(--status-ok-bg); color: var(--status-ok); border: 1px solid rgba(61,170,109,0.2); }
.badge-warning { background: var(--status-warn-bg); color: var(--status-warn); border: 1px solid rgba(196,148,58,0.2); }
.badge-error { background: var(--status-error-bg); color: var(--status-error); border: 1px solid rgba(196,74,74,0.2); }


/* ==========================================
   ALERTS
   ========================================== */

.alert {
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-md);
  border-left: 3px solid;
  margin-bottom: var(--sp-4);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
}

.alert-icon { flex-shrink: 0; font-size: var(--text-lg); }
.alert-content { flex: 1; }
.alert-title { font-weight: 600; margin-bottom: var(--sp-1); font-size: var(--text-sm); }
.alert-message { font-size: var(--text-sm); line-height: 1.6; }

.alert-success { background: var(--status-ok-bg); border-left-color: var(--status-ok); color: var(--status-ok); }
.alert-error { background: var(--status-error-bg); border-left-color: var(--status-error); color: var(--status-error); }
.alert-warning { background: var(--status-warn-bg); border-left-color: var(--status-warn); color: var(--status-warn); }
.alert-info { background: var(--accent-ghost); border-left-color: var(--accent); color: var(--accent); }


/* ==========================================
   TABLES
   ========================================== */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: var(--border-panel);
}

.modern-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-raised);
}
.modern-table thead { background: var(--surface-panel); }
.modern-table th {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: var(--border-panel);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.modern-table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: var(--border-subtle);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.modern-table tbody tr { transition: background var(--t-fast); }
.modern-table tbody tr:hover { background: var(--accent-ghost); }
.modern-table tbody tr:last-child td { border-bottom: none; }


/* ==========================================
   MODALS (extended from base)
   ========================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 15, 0.85);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-bg);
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.active { display: flex; }

.modal {
  background: var(--surface-raised);
  border: var(--border-active);
  border-radius: var(--radius-lg);
  max-width: 700px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-bright);
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-xl);
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--t-fast), background var(--t-fast);
}
.modal-close:hover { color: var(--status-error); background: var(--status-error-bg); }
.modal-body { padding: var(--sp-5); }
.modal-footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
}


/* ==========================================
   TABS
   ========================================== */

.tabs {
  display: flex;
  border-bottom: var(--border-panel);
  margin-bottom: var(--sp-6);
  gap: 0;
}

.tab {
  padding: var(--sp-3) var(--sp-5);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
  position: relative;
  font-family: var(--font-body);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab::after { display: none; }
.tab:hover { color: var(--text-primary); background: var(--accent-ghost); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content { display: none; }
.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}


/* ==========================================
   ACCORDION
   ========================================== */

.accordion { border-radius: var(--radius-lg); overflow: hidden; }
.accordion-item { border-bottom: var(--border-subtle); }
.accordion-item:last-child { border-bottom: none; }

.accordion-header {
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface-raised);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background var(--t-fast);
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--text-primary);
}
.accordion-header:hover { background: var(--surface-panel); }

.accordion-icon { transition: transform var(--t-base); font-size: var(--text-sm); color: var(--text-muted); }
.accordion-item.active .accordion-icon { transform: rotate(180deg); }

.accordion-content { display: none; overflow: hidden; }
.accordion-item.active .accordion-content {
  display: block;
  animation: fadeInDown 0.2s ease-out;
}

.accordion-body {
  padding: var(--sp-4) var(--sp-5);
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: var(--text-sm);
}


/* ==========================================
   TOOLTIPS
   ========================================== */

.tooltip { position: relative; display: inline-block; cursor: help; }

.tooltip-text {
  visibility: hidden;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-elevated);
  color: var(--text-primary);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  white-space: nowrap;
  z-index: var(--z-dropdown);
  opacity: 0;
  transition: opacity var(--t-fast);
  border: var(--border-panel);
}
.tooltip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--surface-elevated);
}
.tooltip:hover .tooltip-text { visibility: visible; opacity: 1; }


/* ==========================================
   DROPDOWN
   ========================================== */

.dropdown { position: relative; display: inline-block; }

.dropdown-toggle {
  background: var(--surface-raised);
  border: var(--border-panel);
  color: var(--text-primary);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  transition: border-color var(--t-fast);
  font-family: var(--font-body);
  font-size: var(--text-sm);
}
.dropdown-toggle:hover { border-color: var(--accent-muted); }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--surface-elevated);
  border: var(--border-active);
  border-radius: var(--radius-md);
  min-width: 180px;
  padding: var(--sp-1) 0;
  z-index: var(--z-dropdown);
  display: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.dropdown.active .dropdown-menu {
  display: block;
  animation: fadeInDown 0.15s ease-out;
}

.dropdown-item {
  padding: var(--sp-2) var(--sp-4);
  color: var(--text-primary);
  text-decoration: none;
  display: block;
  transition: background var(--t-fast);
  cursor: pointer;
  font-size: var(--text-sm);
}
.dropdown-item:hover { background: var(--accent-ghost); color: var(--accent); }

.dropdown-divider { height: 1px; background: var(--border-subtle); margin: var(--sp-1) 0; }


/* ==========================================
   PAGINATION
   ========================================== */

.pagination {
  display: flex;
  gap: var(--sp-1);
  justify-content: center;
  align-items: center;
  padding: var(--sp-6) 0;
}

.page-link {
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-raised);
  border: var(--border-panel);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--t-fast);
  font-size: var(--text-sm);
  font-weight: 500;
}
.page-link:hover { border-color: var(--accent-muted); color: var(--accent); }
.page-link.active {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: #fff;
}
.page-link.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }


/* ==========================================
   BREADCRUMBS
   ========================================== */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) 0;
  font-size: var(--text-xs);
}
.breadcrumb-item a {
  color: var(--text-muted);
  transition: color var(--t-fast);
}
.breadcrumb-item a:hover { color: var(--accent); }
.breadcrumb-item.active { color: var(--text-secondary); }
.breadcrumb-separator { color: var(--text-ghost); }


/* ==========================================
   PROGRESS
   ========================================== */

.progress {
  width: 100%;
  height: 4px;
  background: var(--surface-panel);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-sm);
  transition: width 0.3s var(--ease-out);
}
.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
