/* ══════════════════════════════════════════
   CAPTAINS PORTAL — Shared Layout CSS
   zsoffshore.life/captains/
   ══════════════════════════════════════════ */

:root {
  --deep-teal: #007BA7;
  --ocean-teal: #008080;
  --dark-navy: #0A0E14;
  --charcoal: #1A2535;
  --card-bg: #1E2A3A;
  --mid-gray: #6B7280;
  --light-gray: #F5F7FA;
  --white: #FFFFFF;
  --signal-gold: #C9A84C;
  --success: #4ade80;
  --warning: #f59e0b;
  --danger: #ef4444;
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Courier New', monospace;
  --sidebar-width: 240px;
  --tabbar-height: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-primary);
  background: var(--dark-navy);
  color: var(--light-gray);
  line-height: 1.6;
  overflow-x: hidden;
}
::selection { background: rgba(0,123,167,0.3); color: var(--white); }

/* ══════════════════════════════════════════
   SIDEBAR (Desktop)
   ══════════════════════════════════════════ */
#portal-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--charcoal);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-header {
  padding: 28px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-logo {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: 16px;
}
.sidebar-logo span {
  color: var(--deep-teal);
}
.sidebar-captain {
  font-size: 13px;
  font-weight: 500;
  color: var(--white);
}
.sidebar-vessel {
  font-size: 11px;
  color: var(--mid-gray);
  letter-spacing: 0.5px;
}
.sidebar-vessel-photo {
  margin-top: 12px;
  border-radius: 8px;
  overflow: hidden;
  line-height: 0;
}
.sidebar-vessel-photo img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.sidebar-vessel-photo img:hover {
  opacity: 1;
}

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

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--mid-gray);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: all 0.2s ease;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: var(--font-primary);
}
.sidebar-link:hover {
  color: var(--white);
  background: rgba(255,255,255,0.03);
}
.sidebar-link.active {
  color: var(--deep-teal);
  background: rgba(0,123,167,0.08);
  border-right: 2px solid var(--deep-teal);
}
.sidebar-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}
.sidebar-link.active svg,
.sidebar-link:hover svg {
  opacity: 1;
}

/* ── Pulsing green dot for Hey Sedna ── */
.sedna-pulse span {
  position: relative;
}
.sedna-pulse span::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #00e676;
  border-radius: 50%;
  margin-left: 8px;
  vertical-align: middle;
  box-shadow: 0 0 6px rgba(0,230,118,0.6);
  animation: sednaPulse 2s ease-in-out infinite;
}
@keyframes sednaPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(0,230,118,0.6); }
  50%      { opacity: 0.4; box-shadow: 0 0 2px rgba(0,230,118,0.2); }
}

.sidebar-footer {
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.logout-btn {
  color: var(--mid-gray) !important;
}
.logout-btn:hover {
  color: var(--danger) !important;
}

/* ══════════════════════════════════════════
   MOBILE TAB BAR
   ══════════════════════════════════════════ */
#portal-tabbar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--tabbar-height);
  background: var(--charcoal);
  border-top: 1px solid rgba(255,255,255,0.06);
  z-index: 50;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 8px;
  color: var(--mid-gray);
  text-decoration: none;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  transition: color 0.2s ease;
  min-width: 52px;
}
.tab-item:hover,
.tab-item.active {
  color: var(--deep-teal);
}
.tab-item svg {
  opacity: 0.6;
}
.tab-item.active svg,
.tab-item:hover svg {
  opacity: 1;
}

/* ══════════════════════════════════════════
   MAIN CONTENT AREA
   ══════════════════════════════════════════ */
.portal-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 32px 40px 40px;
}

.portal-page-header {
  margin-bottom: 32px;
}
.portal-page-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--deep-teal);
  margin-bottom: 4px;
}
.portal-page-title {
  font-size: 28px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: -0.3px;
}

/* ══════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════ */
.card {
  background: var(--charcoal);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 24px;
  transition: border-color 0.2s ease;
}
.card:hover {
  border-color: rgba(0,123,167,0.2);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--mid-gray);
}
.card-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
}
.card-label {
  font-size: 12px;
  color: var(--mid-gray);
  margin-top: 4px;
}

/* ══════════════════════════════════════════
   STAT GRID (Dashboard)
   ══════════════════════════════════════════ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--charcoal);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 20px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-value span {
  font-size: 14px;
  font-weight: 400;
  color: var(--mid-gray);
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--mid-gray);
}

/* ══════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--mid-gray);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
}
tbody tr:hover {
  background: rgba(0,123,167,0.04);
}

/* ══════════════════════════════════════════
   STATUS BADGES
   ══════════════════════════════════════════ */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-complete {
  color: var(--success);
  background: rgba(74,222,128,0.08);
  border: 1px solid rgba(74,222,128,0.15);
}
.badge-processing {
  color: var(--signal-gold);
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.15);
}
.badge-received {
  color: var(--deep-teal);
  background: rgba(0,123,167,0.08);
  border: 1px solid rgba(0,123,167,0.15);
}
.badge-released {
  color: #a78bfa;
  background: rgba(167,139,250,0.08);
  border: 1px solid rgba(167,139,250,0.15);
}
.badge-retained {
  color: var(--success);
  background: rgba(74,222,128,0.08);
  border: 1px solid rgba(74,222,128,0.15);
}

/* ══════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 6px;
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  border: none;
}
.btn-primary {
  background: var(--deep-teal);
  color: var(--white);
}
.btn-primary:hover {
  background: #0090c4;
}
.btn-outline {
  background: transparent;
  color: var(--deep-teal);
  border: 1px solid rgba(0,123,167,0.3);
}
.btn-outline:hover {
  border-color: var(--deep-teal);
  background: rgba(0,123,167,0.06);
}

/* ══════════════════════════════════════════
   COMING SOON OVERLAY
   ══════════════════════════════════════════ */
.coming-soon {
  position: relative;
}
.coming-soon-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10,14,20,0.75);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  z-index: 5;
}
.coming-soon-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--signal-gold);
  border: 1px solid rgba(201,168,76,0.3);
  padding: 8px 20px;
  border-radius: 6px;
  background: rgba(10,14,20,0.8);
}

/* ══════════════════════════════════════════
   FORM ELEMENTS
   ══════════════════════════════════════════ */
.form-group {
  margin-bottom: 20px;
}
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--mid-gray);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--dark-navy);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: var(--white);
  font-family: var(--font-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}
.form-input:focus {
  border-color: var(--deep-teal);
}
.form-input:read-only {
  color: var(--mid-gray);
  cursor: default;
}
select.form-input {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* ══════════════════════════════════════════
   SEARCH / FILTER BAR
   ══════════════════════════════════════════ */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-bar .form-input {
  flex: 1;
  min-width: 200px;
}
.filter-bar select.form-input {
  flex: 0 0 180px;
}

/* ══════════════════════════════════════════
   SECTION DIVIDERS
   ══════════════════════════════════════════ */
.section-divider {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--mid-gray);
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* ══════════════════════════════════════════
   ACTIVITY FEED
   ══════════════════════════════════════════ */
.feed-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.feed-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--deep-teal);
  margin-top: 6px;
  flex-shrink: 0;
}
.feed-text {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  line-height: 1.5;
}
.feed-text strong {
  color: var(--white);
  font-weight: 500;
}
.feed-time {
  font-size: 11px;
  color: var(--mid-gray);
  margin-top: 2px;
}

/* ══════════════════════════════════════════
   MOBILE HAMBURGER HEADER
   ══════════════════════════════════════════ */
#portal-mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--charcoal);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  z-index: 60;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.portal-mobile-logo {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--white);
}
.portal-mobile-logo span {
  color: var(--deep-teal);
}

.portal-hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 101;
}
.portal-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.portal-hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.portal-hamburger.active span:nth-child(2) {
  opacity: 0;
}
.portal-hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

#portal-mobile-nav {
  display: none;
  position: fixed;
  top: 56px;
  left: 0; right: 0; bottom: 0;
  background: rgba(10,14,20,0.97);
  z-index: 59;
  overflow-y: auto;
  padding: 16px 0;
}
#portal-mobile-nav.open {
  display: block;
}

.portal-mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  color: var(--mid-gray);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: all 0.2s ease;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: var(--font-primary);
}
.portal-mobile-nav-link:hover {
  color: var(--white);
  background: rgba(255,255,255,0.03);
}
.portal-mobile-nav-link.active {
  color: var(--deep-teal);
  background: rgba(0,123,167,0.08);
}
.portal-mobile-nav-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}
.portal-mobile-nav-link.active svg,
.portal-mobile-nav-link:hover svg {
  opacity: 1;
}

.portal-mobile-nav-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 12px 24px;
}

.portal-mobile-nav-captain {
  padding: 8px 24px 16px;
  font-size: 12px;
  color: var(--mid-gray);
}
.portal-mobile-nav-captain strong {
  display: block;
  color: var(--white);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 960px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  #portal-sidebar {
    display: none;
  }
  #portal-tabbar {
    display: flex;
  }
  #portal-mobile-header {
    display: flex;
  }
  .portal-main {
    margin-left: 0;
    padding: 72px 16px calc(var(--tabbar-height) + 16px);
  }
  .portal-page-title {
    font-size: 22px;
  }
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .stat-value {
    font-size: 22px;
  }
  .filter-bar {
    flex-direction: column;
  }
  .filter-bar .form-input,
  .filter-bar select.form-input {
    flex: 1 1 100%;
    min-width: auto;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stat-card {
    padding: 14px;
  }
  .stat-value {
    font-size: 20px;
  }
  .portal-main {
    padding: 16px 12px calc(var(--tabbar-height) + 12px);
  }
}
