/* ════════════════════════════════════════════════════════════════
   ICCOM HydroGuard — Operator Dashboard Styles
   Loaded after portal-shared.css + shared.css. Uses ops- prefix.
   ════════════════════════════════════════════════════════════════ */

/* ── Layout ───────────────────────────────────────────────────── */
.ops-layout { display:flex; min-height:100vh; background:var(--light,#f4f6f8); }

.ops-sidebar {
  width:250px; min-width:250px; background:var(--navy,#0f2b3c); color:#8899AA;
  display:flex; flex-direction:column; transition:width .2s; overflow-y:auto; overflow-x:hidden;
  position:fixed; top:0; left:0; bottom:0; z-index:100;
}
.ops-sidebar.collapsed { width:56px; min-width:56px; }
.ops-sidebar.collapsed .ops-sidebar-label,
.ops-sidebar.collapsed .ops-sidebar-group-title,
.ops-sidebar.collapsed .ops-sidebar-brand-text { display:none; }

.ops-sidebar-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px; border-bottom:1px solid rgba(255,255,255,.08); min-height:56px;
}
.ops-sidebar-brand { display:flex; align-items:center; gap:8px; text-decoration:none; }
.ops-sidebar-brand-text { color:#fff; font-weight:800; font-size:18px; white-space:nowrap; }
.ops-sidebar-brand-text span { color:var(--teal-light); }
.ops-sidebar-toggle {
  background:none; border:none; color:#8899AA; cursor:pointer; padding:4px;
  font-size:18px; line-height:1; transition:color .2s;
}
.ops-sidebar-toggle:hover { color:#fff; }

.ops-sidebar-group { padding:8px 0; }
.ops-sidebar-group-title {
  padding:8px 16px 4px; font-size:10px; font-weight:700; text-transform:uppercase;
  letter-spacing:1px; color:#5a6f80; white-space:nowrap;
}
.ops-sidebar-item {
  display:flex; align-items:center; gap:10px; padding:8px 16px; color:#8899AA;
  text-decoration:none; font-size:13px; font-weight:500; transition:all .15s;
  white-space:nowrap; border-left:3px solid transparent;
}
.ops-sidebar-item:hover { color:#fff; background:rgba(255,255,255,.05); }
.ops-sidebar-item.active {
  color:var(--teal-light); background:rgba(43,196,195,.08);
  border-left-color:var(--teal-light);
}
.ops-sidebar-item .ops-icon { width:18px; text-align:center; flex-shrink:0; }
.ops-sidebar-footer { margin-top:auto; padding:12px 16px; border-top:1px solid rgba(255,255,255,.08); }

.ops-main { flex:1; margin-left:250px; display:flex; flex-direction:column; min-height:100vh; transition:margin-left .2s; }
.ops-sidebar.collapsed ~ .ops-main { margin-left:56px; }

.ops-header {
  background:#fff; border-bottom:1px solid #e2e8f0; padding:0 24px; height:52px;
  display:flex; align-items:center; justify-content:space-between; position:sticky; top:0; z-index:50;
}
.ops-breadcrumb { font-size:14px; color:var(--dark,#333); font-weight:600; }
.ops-breadcrumb span { color:#8899AA; font-weight:400; }
.ops-header-actions { display:flex; align-items:center; gap:12px; }
.ops-header-user {
  display:flex; align-items:center; gap:8px; cursor:pointer; padding:4px 8px;
  border-radius:6px; font-size:13px; color:var(--dark); transition:background .15s;
}
.ops-header-user:hover { background:var(--light); }

.ops-content { padding:24px; max-width:1400px; width:100%; margin:0 auto; }

/* ── Login ─────────────────────────────────────────────────────── */
.ops-login-page {
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg,var(--navy) 0%,#0D3550 60%,var(--teal) 100%);
}
.ops-login-card {
  background:#fff; border-radius:16px; padding:40px; width:100%; max-width:420px;
  box-shadow:0 20px 60px rgba(0,0,0,.2);
}
.ops-login-title { text-align:center; margin-bottom:8px; }
.ops-login-title h1 { font-size:24px; font-weight:800; color:var(--navy); margin:0; }
.ops-login-title h1 span { color:var(--teal); }
.ops-login-subtitle { text-align:center; color:#8899AA; font-size:13px; margin-bottom:24px; }
.ops-login-form { display:flex; flex-direction:column; gap:16px; }
.ops-login-form label { font-size:13px; font-weight:600; color:var(--dark); margin-bottom:4px; display:block; }
.ops-login-form input {
  width:100%; padding:10px 12px; border:1px solid #d1d5db; border-radius:8px;
  font-size:14px; transition:border-color .15s; box-sizing:border-box;
}
.ops-login-form input:focus { outline:none; border-color:var(--teal); box-shadow:0 0 0 3px rgba(10,110,138,.1); }
.ops-login-error { color:#ef4444; font-size:13px; text-align:center; display:none; }
.ops-login-error.visible { display:block; }
.ops-login-mfa { display:none; }
.ops-login-mfa.visible { display:block; }

/* ── Module Layout ─────────────────────────────────────────────── */
.ops-module-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; flex-wrap:wrap; gap:12px; }
.ops-module-header h2 { font-size:22px; font-weight:800; color:var(--navy); margin:0; }

.ops-card { background:#fff; border-radius:12px; padding:24px; box-shadow:0 1px 3px rgba(0,0,0,.06); margin-bottom:20px; }
.ops-card-title { font-size:16px; font-weight:700; color:var(--navy); margin:0 0 16px; }

.ops-kpi-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:16px; margin-bottom:24px; }
.ops-kpi-card {
  background:#fff; border-radius:12px; padding:20px; box-shadow:0 1px 3px rgba(0,0,0,.06);
  border-top:3px solid var(--teal); text-align:center;
}
.ops-kpi-card.danger { border-top-color:#ef4444; }
.ops-kpi-val { font-size:28px; font-weight:800; color:var(--teal); line-height:1.2; }
.ops-kpi-card.danger .ops-kpi-val { color:#ef4444; }
.ops-kpi-label { font-size:12px; font-weight:600; color:#8899AA; text-transform:uppercase; letter-spacing:.5px; margin-top:4px; }
.ops-kpi-sub { font-size:12px; color:#8899AA; margin-top:2px; }

/* ── Tables ────────────────────────────────────────────────────── */
.ops-table-wrap { overflow-x:auto; }
.ops-table { width:100%; border-collapse:collapse; font-size:13px; }
.ops-table thead th {
  background:var(--navy); color:#fff; padding:10px 12px; text-align:left;
  font-weight:600; font-size:12px; text-transform:uppercase; letter-spacing:.5px;
  white-space:nowrap; position:sticky; top:0;
}
.ops-table thead th.sortable { cursor:pointer; user-select:none; }
.ops-table thead th.sortable:hover { background:#1a3d52; }
.ops-table thead th .sort-arrow { margin-left:4px; opacity:.5; }
.ops-table thead th.sorted .sort-arrow { opacity:1; }
.ops-table tbody td { padding:10px 12px; border-bottom:1px solid #e2e8f0; color:var(--dark); vertical-align:middle; }
.ops-table tbody tr:hover { background:rgba(10,110,138,.03); }
.ops-table tbody tr:last-child td { border-bottom:none; }
.ops-table code { font-size:12px; background:#f1f5f9; padding:2px 6px; border-radius:4px; }

.ops-pagination {
  display:flex; align-items:center; justify-content:space-between; padding:12px 0;
  font-size:13px; color:#8899AA;
}
.ops-pagination-info { }
.ops-pagination-btns { display:flex; gap:4px; }

/* ── Forms ──────────────────────────────────────────────────────── */
.ops-form-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.ops-form-grid.single-col { grid-template-columns:1fr; }
.ops-form-group { display:flex; flex-direction:column; }
.ops-form-group.full-width { grid-column:1/-1; }
.ops-form-group label { font-size:13px; font-weight:600; color:var(--dark); margin-bottom:4px; }
.ops-form-group input,
.ops-form-group select,
.ops-form-group textarea {
  padding:8px 12px; border:1px solid #d1d5db; border-radius:6px; font-size:14px;
  transition:border-color .15s; font-family:inherit; box-sizing:border-box;
}
.ops-form-group input:focus,
.ops-form-group select:focus,
.ops-form-group textarea:focus { outline:none; border-color:var(--teal); box-shadow:0 0 0 3px rgba(10,110,138,.08); }
.ops-form-group textarea { resize:vertical; min-height:80px; }
.ops-form-group .ops-form-error { font-size:12px; color:#ef4444; margin-top:2px; display:none; }
.ops-form-group .ops-form-error.visible { display:block; }
.ops-form-group.has-error input,
.ops-form-group.has-error select { border-color:#ef4444; }
.ops-form-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:16px; grid-column:1/-1; }

/* ── Buttons ───────────────────────────────────────────────────── */
.ops-btn {
  display:inline-flex; align-items:center; gap:6px; padding:8px 16px; border-radius:6px;
  font-size:13px; font-weight:600; cursor:pointer; border:1px solid transparent;
  transition:all .15s; text-decoration:none; white-space:nowrap; font-family:inherit;
}
.ops-btn:disabled { opacity:.5; cursor:not-allowed; }
.ops-btn-primary { background:var(--teal); color:#fff; border-color:var(--teal); }
.ops-btn-primary:hover:not(:disabled) { background:var(--teal-light); border-color:var(--teal-light); }
.ops-btn-secondary { background:transparent; color:var(--teal); border-color:var(--teal); }
.ops-btn-secondary:hover:not(:disabled) { background:rgba(10,110,138,.06); }
.ops-btn-danger { background:#ef4444; color:#fff; border-color:#ef4444; }
.ops-btn-danger:hover:not(:disabled) { background:#dc2626; }
.ops-btn-ghost { background:transparent; color:var(--teal); }
.ops-btn-ghost:hover:not(:disabled) { background:rgba(10,110,138,.06); }
.ops-btn-sm { padding:5px 10px; font-size:12px; }

/* ── Badges ────────────────────────────────────────────────────── */
.ops-badge {
  display:inline-block; padding:2px 8px; border-radius:10px; font-size:11px;
  font-weight:600; text-transform:uppercase; letter-spacing:.3px;
}
.ops-badge-ok { background:#d1fae5; color:#065f46; }
.ops-badge-warning { background:#fef3c7; color:#92400e; }
.ops-badge-critical { background:#fee2e2; color:#991b1b; }
.ops-badge-info { background:#e0f4f8; color:#0A6E8A; }
.ops-badge-neutral { background:#f1f5f9; color:#475569; }

/* ── Toast ──────────────────────────────────────────────────────── */
.ops-toast-container { position:fixed; bottom:24px; right:24px; z-index:9999; display:flex; flex-direction:column-reverse; gap:8px; }
.ops-toast {
  display:flex; align-items:center; gap:10px; padding:12px 16px; border-radius:8px;
  background:#fff; box-shadow:0 4px 12px rgba(0,0,0,.15); font-size:13px;
  animation:ops-toast-in .3s ease; min-width:280px; max-width:420px;
  border-left:4px solid #8899AA;
}
.ops-toast-success { border-left-color:#10b981; }
.ops-toast-error { border-left-color:#ef4444; }
.ops-toast-warning { border-left-color:#f59e0b; }
.ops-toast-info { border-left-color:var(--teal); }
.ops-toast-close { margin-left:auto; background:none; border:none; cursor:pointer; color:#8899AA; font-size:16px; padding:0 4px; }
@keyframes ops-toast-in { from { transform:translateX(100%); opacity:0; } to { transform:translateX(0); opacity:1; } }

/* ── Modals ─────────────────────────────────────────────────────── */
.ops-modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.4); z-index:10000;
  display:flex; align-items:center; justify-content:center; padding:24px;
}
.ops-modal {
  background:#fff; border-radius:12px; width:100%; max-width:560px;
  box-shadow:0 20px 60px rgba(0,0,0,.2); animation:ops-modal-in .2s ease;
}
.ops-modal-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 20px; border-bottom:1px solid #e2e8f0;
}
.ops-modal-header h3 { margin:0; font-size:16px; font-weight:700; color:var(--navy); }
.ops-modal-close { background:none; border:none; cursor:pointer; color:#8899AA; font-size:20px; padding:0; }
.ops-modal-body { padding:20px; }
.ops-modal-footer { display:flex; justify-content:flex-end; gap:8px; padding:16px 20px; border-top:1px solid #e2e8f0; }
@keyframes ops-modal-in { from { transform:scale(.95); opacity:0; } to { transform:scale(1); opacity:1; } }

/* ── Filters ───────────────────────────────────────────────────── */
.ops-filters { display:flex; flex-wrap:wrap; gap:10px; margin-bottom:16px; align-items:flex-end; }
.ops-filters select,
.ops-filters input { padding:6px 10px; border:1px solid #d1d5db; border-radius:6px; font-size:13px; }
.ops-filters select:focus,
.ops-filters input:focus { outline:none; border-color:var(--teal); }
.ops-filter-group { display:flex; flex-direction:column; gap:2px; }
.ops-filter-group label { font-size:11px; font-weight:600; color:#8899AA; text-transform:uppercase; }

/* ── Tabs ───────────────────────────────────────────────────────── */
.ops-tabs { display:flex; gap:0; border-bottom:2px solid #e2e8f0; margin-bottom:20px; }
.ops-tab {
  padding:10px 20px; font-size:13px; font-weight:600; color:#8899AA; cursor:pointer;
  border-bottom:2px solid transparent; margin-bottom:-2px; transition:all .15s;
}
.ops-tab:hover { color:var(--dark); }
.ops-tab.active { color:var(--teal); border-bottom-color:var(--teal); }

/* ── Utilities ─────────────────────────────────────────────────── */
.ops-empty-state { text-align:center; padding:48px 24px; color:#8899AA; }
.ops-empty-state p { margin:8px 0 0; font-size:14px; }
.ops-loading { display:flex; align-items:center; justify-content:center; padding:48px; }
.ops-spinner { width:32px; height:32px; border:3px solid #e2e8f0; border-top-color:var(--teal); border-radius:50%; animation:ops-spin .7s linear infinite; }
@keyframes ops-spin { to { transform:rotate(360deg); } }
.ops-hidden { display:none !important; }
.ops-text-muted { color:#8899AA; }
.ops-text-danger { color:#ef4444; }
.ops-mt-8 { margin-top:8px; } .ops-mt-16 { margin-top:16px; } .ops-mt-24 { margin-top:24px; }
.ops-mb-8 { margin-bottom:8px; } .ops-mb-16 { margin-bottom:16px; } .ops-mb-24 { margin-bottom:24px; }
.ops-flex { display:flex; } .ops-flex-between { justify-content:space-between; } .ops-flex-center { align-items:center; }
.ops-gap-8 { gap:8px; } .ops-gap-16 { gap:16px; }
.ops-grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:20px; }

/* ── MFA Setup ─────────────────────────────────────────────────── */
.ops-mfa-setup { text-align:center; }
.ops-mfa-secret { font-family:monospace; font-size:16px; background:#f1f5f9; padding:12px; border-radius:8px; letter-spacing:2px; word-break:break-all; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width:1024px) {
  .ops-sidebar { width:56px; min-width:56px; }
  .ops-sidebar .ops-sidebar-label,
  .ops-sidebar .ops-sidebar-group-title,
  .ops-sidebar .ops-sidebar-brand-text { display:none; }
  .ops-main { margin-left:56px; }
}

@media (max-width:768px) {
  .ops-sidebar {
    position:fixed; left:-250px; width:250px; z-index:200;
    transition:left .2s;
  }
  .ops-sidebar .ops-sidebar-label,
  .ops-sidebar .ops-sidebar-group-title,
  .ops-sidebar .ops-sidebar-brand-text { display:inline; }
  .ops-sidebar.mobile-open { left:0; }
  .ops-mobile-overlay { position:fixed; inset:0; background:rgba(0,0,0,.3); z-index:150; display:none; }
  .ops-mobile-overlay.visible { display:block; }
  .ops-main { margin-left:0; }
  .ops-header { padding:0 12px; }
  .ops-content { padding:16px; }
  .ops-form-grid { grid-template-columns:1fr; }
  .ops-grid-2 { grid-template-columns:1fr; }
  .ops-kpi-grid { grid-template-columns:1fr 1fr; }
  .ops-module-header { flex-direction:column; align-items:flex-start; }
  .ops-mobile-toggle { display:flex !important; }
}

.ops-mobile-toggle { display:none; background:none; border:none; cursor:pointer; font-size:20px; color:var(--dark); padding:4px; }
