/* Hoss Geo Operations Hub - Professional Dashboard Styles */
:root {
  --primary: #0a2540;
  --primary-light: #1a3a5c;
  --accent: #e07a2f;
  --accent-light: #f4a261;
  --success: #2a9d8f;
  --warning: #e9c46a;
  --danger: #e76f51;
  --inactive: #6c757d;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  line-height: 1.5;
}

/* Login Overlay */
.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--primary) 0%, #0d3b66 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.login-box {
  background: white;
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-box h1 {
  margin: 0 0 0.5rem;
  color: var(--primary);
  font-size: 1.75rem;
}

.login-box p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.login-box input {
  width: 100%;
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}

.login-box button {
  width: 100%;
  padding: 0.875rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.login-box button:hover {
  background: #c96a28;
}

.login-error {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  min-height: 1.2em;
}

/* Header */
header {
  background: var(--primary);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logout-btn {
  background: transparent;
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
}

.logout-btn:hover {
  background: rgba(255,255,255,0.1);
}

/* Navigation */
nav {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  gap: 0.5rem;
  position: sticky;
  top: 64px;
  z-index: 90;
}

nav button {
  background: none;
  border: none;
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

nav button.active,
nav button:hover {
  color: var(--primary);
  border-bottom-color: var(--accent);
}

/* Main Content */
main {
  padding: 2rem;
  max-width: 1600px;
  margin: 0 auto;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-header h2 {
  margin: 0;
  color: var(--primary);
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--card);
  padding: 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  border-top: 4px solid var(--accent);
}

.card .number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.card .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tables */
.table-container {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 2rem;
}

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

th {
  background: var(--primary);
  color: white;
  padding: 0.875rem 1rem;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:hover td {
  background: #f8fafc;
}

tr:last-child td {
  border-bottom: none;
}

/* Status badges */
.status {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status.active { background: #d1fae5; color: #065f46; }
.status.inactive { background: #fee2e2; color: #991b1b; }
.status.upcoming { background: #fef9c3; color: #854d0e; }
.status.vertical { background: #dbeafe; color: #1e40af; }
.status.curve { background: #fef3c7; color: #92400e; }
.status.lateral { background: #ffedd5; color: #9a3412; }
.status.td { background: #e0e7ff; color: #3730a3; }

/* Dynamic cell coloring for Geosteering Status column */
td.status-cell.active {
  background: #d1fae5 !important;
  color: #065f46;
  font-weight: 600;
}
td.status-cell.inactive {
  background: #fee2e2 !important;
  color: #991b1b;
  font-weight: 600;
}
td.status-cell.upcoming {
  background: #fef9c3 !important;
  color: #854d0e;
  font-weight: 600;
}

/* Credentials sections */
.cred-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.cred-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.cred-card h3 {
  margin: 0;
  padding: 1rem 1.25rem;
  background: var(--primary-light);
  color: white;
  font-size: 1rem;
}

.cred-card table {
  font-size: 0.8rem;
}

.cred-card td, .cred-card th {
  padding: 0.5rem 0.75rem;
}

/* Handover */
.handover-block {
  background: var(--card);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  white-space: pre-wrap;
  font-family: 'Segoe UI', system-ui, sans-serif;
  line-height: 1.6;
}

.handover-block h3 {
  margin-top: 0;
  color: var(--primary);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.5rem;
}

/* Edit mode */
.edit-btn, .save-btn {
  background: var(--success);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.edit-btn:hover, .save-btn:hover {
  opacity: 0.9;
}

[contenteditable="true"] {
  outline: 2px dashed var(--accent);
  background: #fffbeb;
  min-height: 1em;
}

footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

@media (max-width: 768px) {
  header, nav, main {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  nav {
    overflow-x: auto;
  }
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}
