﻿/* ============================================================
   Sam Portal v2 â€” Main Stylesheet
   ============================================================ */

/* ------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   ------------------------------------------------------------ */
:root {
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface2:    #21262d;
  --border:      #30363d;
  --accent:      #00d4aa;
  --accent-dim:  #00a882;
  --text:        #e6edf3;
  --text-dim:    #8b949e;
  --danger:      #f85149;
  --success:     #2ea043;
  --warning:     #d29922;

  --font-ui:   system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Courier New', Consolas, 'Liberation Mono', monospace;

  --sidebar-width: 240px;
  --header-height: 56px;
  --radius-sm:  4px;
  --radius-md:  6px;
  --radius-lg:  8px;
  --radius-xl:  10px;
}

/* ------------------------------------------------------------
   Global Reset
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

body {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  display: block;
  max-width: 100%;
}

/* ------------------------------------------------------------
   Sidebar
   ------------------------------------------------------------ */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo span {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
  gap: 2px;
  list-style: none;
}

.sidebar-nav a,
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-dim);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
  border-left: 2px solid transparent;
}

.sidebar-nav a:hover,
.nav-link:hover {
  background: var(--surface2);
  color: var(--text);
  text-decoration: none;
}

.sidebar-nav a.nav-active,
.nav-link.nav-active {
  background: var(--surface2);
  color: var(--accent);
  border-left-color: var(--accent);
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-dim);
}

/* ------------------------------------------------------------
   Main Content Area
   ------------------------------------------------------------ */
#main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ------------------------------------------------------------
   Header Bar
   ------------------------------------------------------------ */
#header {
  height: var(--header-height);
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-dim);
}

.user-badge .username {
  color: var(--text);
  font-weight: 500;
}

.user-badge .role-tag {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ------------------------------------------------------------
   Content Area
   ------------------------------------------------------------ */
#content,
.content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ------------------------------------------------------------
   Cards
   ------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card + .card {
  margin-top: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font-ui);
  font-weight: 500;
  line-height: 1;
  transition: opacity 0.15s ease, background 0.15s ease, filter 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover {
  filter: brightness(1.1);
}

.btn:active {
  filter: brightness(0.9);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  filter: none;
}

.btn-primary {
  background: var(--accent);
  color: #0d1117;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-dim);
  filter: none;
}

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

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

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--surface2);
  filter: none;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 16px;
}

.btn-icon {
  padding: 6px;
  width: 32px;
  height: 32px;
}

/* ------------------------------------------------------------
   Tables
   ------------------------------------------------------------ */
table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

thead {
  background: var(--surface2);
}

th {
  background: var(--surface2);
  color: var(--text-dim);
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

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

tr:hover td {
  background: var(--surface2);
}

tbody tr {
  transition: background 0.1s ease;
}

/* ------------------------------------------------------------
   Status Badges
   ------------------------------------------------------------ */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
}

.badge-pending {
  background: rgba(210, 153, 34, 0.2);
  color: var(--warning);
}

.badge-approved {
  background: rgba(46, 160, 67, 0.2);
  color: var(--success);
}

.badge-rejected {
  background: rgba(248, 81, 73, 0.2);
  color: var(--danger);
}

.badge-completed {
  background: rgba(0, 212, 170, 0.2);
  color: var(--accent);
}

.badge-planned {
  background: rgba(56, 139, 253, 0.2);
  color: #79c0ff;
}

.badge-dry_run_ok {
  background: rgba(210, 153, 34, 0.2);
  color: var(--warning);
}

.badge-executing {
  background: rgba(210, 153, 34, 0.2);
  color: var(--warning);
  animation: badge-pulse 1.5s ease-in-out infinite;
}

.badge-failed {
  background: rgba(248, 81, 73, 0.2);
  color: var(--danger);
}

.badge-archived {
  background: var(--surface2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.badge-online {
  background: rgba(46, 160, 67, 0.2);
  color: var(--success);
}

.badge-offline {
  background: rgba(248, 81, 73, 0.2);
  color: var(--danger);
}

@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ------------------------------------------------------------
   Node Status Dots
   ------------------------------------------------------------ */
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

.dot-online {
  background: var(--success);
  animation: pulse 2s ease-in-out infinite;
}

.dot-offline {
  background: var(--danger);
}

.dot-unknown {
  background: var(--text-dim);
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.2);
  }
}

/* ------------------------------------------------------------
   Node Cards Grid
   ------------------------------------------------------------ */
.nodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.node-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s ease;
}

.node-card:hover {
  border-color: var(--accent-dim);
}

.node-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.node-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.node-role {
  font-size: 13px;
  color: var(--text-dim);
}

.node-ip {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.node-status {
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
}

/* ------------------------------------------------------------
   Chat UI
   ------------------------------------------------------------ */
#chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

#messages::-webkit-scrollbar {
  width: 6px;
}

#messages::-webkit-scrollbar-track {
  background: transparent;
}

#messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.message {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
  position: relative;
}

.message.user {
  align-self: flex-end;
  background: var(--accent);
  color: #0d1117;
  border-radius: 12px 12px 4px 12px;
  font-weight: 500;
}

.message.sam,
.message.assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 4px;
  color: var(--text);
}

.message-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  opacity: 0.8;
}

.message.user .message-meta {
  text-align: right;
  color: rgba(13, 17, 23, 0.6);
}

.message-typing {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 4px;
  padding: 14px 18px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: var(--text-dim);
  border-radius: 50%;
  animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%            { transform: translateY(-6px); opacity: 1; }
}

#chat-input-area {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--bg);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  resize: none;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font-ui);
  line-height: 1.5;
  min-height: 42px;
  max-height: 160px;
  overflow-y: auto;
  transition: border-color 0.15s ease;
}

#chat-input:focus {
  outline: none;
  border-color: var(--accent);
}

#chat-input::placeholder {
  color: var(--text-dim);
}

.request-banner {
  margin: 0 20px 12px;
  padding: 12px 16px;
  background: rgba(46, 160, 67, 0.15);
  border: 1px solid var(--success);
  border-radius: var(--radius-md);
  color: var(--success);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.request-banner a {
  color: var(--success);
  font-weight: 600;
  white-space: nowrap;
}

.request-banner-close {
  background: none;
  border: none;
  color: var(--success);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  opacity: 0.7;
  padding: 0;
}

.request-banner-close:hover {
  opacity: 1;
}

/* ------------------------------------------------------------
   Forms
   ------------------------------------------------------------ */
.form-group {
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
}

label.required::after {
  content: ' *';
  color: var(--danger);
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
select,
textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-ui);
  line-height: 1.5;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

input[type='text']:focus,
input[type='email']:focus,
input[type='password']:focus,
input[type='number']:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

input[type='text']::placeholder,
input[type='email']::placeholder,
input[type='password']::placeholder,
textarea::placeholder {
  color: var(--text-dim);
  opacity: 0.7;
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238b949e' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

select option {
  background: var(--surface2);
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.form-error {
  margin-top: 4px;
  font-size: 12px;
  color: var(--danger);
}

.form-hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-dim);
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

/* ------------------------------------------------------------
   Modal
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fade-in 0.15s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  min-width: 400px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  animation: slide-up 0.2s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-lg {
  max-width: 800px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 2px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}

.modal-close:hover {
  color: var(--text);
}

.modal-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ------------------------------------------------------------
   Toast Notifications
   ------------------------------------------------------------ */
.toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  animation: slide-in 0.2s ease;
  pointer-events: all;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  max-width: 320px;
  word-break: break-word;
}

.toast-success { background: var(--success); }
.toast-error   { background: var(--danger);  }
.toast-info    { background: #388bfd;        }
.toast-warning { background: var(--warning); color: #0d1117; }

@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes slide-out {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

.toast.removing {
  animation: slide-out 0.2s ease forwards;
}

/* ------------------------------------------------------------
   Login Page
   ------------------------------------------------------------ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background: var(--bg);
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 360px;
  max-width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-text {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  display: block;
}

.login-logo-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}

.login-error {
  background: rgba(248, 81, 73, 0.15);
  border: 1px solid var(--danger);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.login-error.visible {
  display: block;
}

.login-card .btn-primary {
  width: 100%;
  padding: 10px 16px;
  font-size: 15px;
  margin-top: 8px;
}

/* ------------------------------------------------------------
   Page Titles and Section Headers
   ------------------------------------------------------------ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-dim);
  margin-top: 2px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

/* ------------------------------------------------------------
   Tabs
   ------------------------------------------------------------ */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font-ui);
}

.tab:hover {
  color: var(--text);
}

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

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ------------------------------------------------------------
   Code / Log Display
   ------------------------------------------------------------ */
.code-block,
pre {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  color: var(--text);
  white-space: pre;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  color: var(--accent);
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: inherit;
}

.log-output {
  background: #010409;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 400px;
  color: #c9d1d9;
  white-space: pre;
}

/* ------------------------------------------------------------
   Action Buttons in Table Rows
   ------------------------------------------------------------ */
.action-buttons {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------
   Empty State
   ------------------------------------------------------------ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-dim);
  text-align: center;
  gap: 8px;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-dim);
}

.empty-state-sub {
  font-size: 14px;
  color: var(--text-dim);
  opacity: 0.7;
}

/* ------------------------------------------------------------
   Loading / Spinner
   ------------------------------------------------------------ */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 12px;
  color: var(--text-dim);
}

/* ------------------------------------------------------------
   Alerts / Info Boxes
   ------------------------------------------------------------ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  border-left: 3px solid;
  margin-bottom: 16px;
}

.alert-info {
  background: rgba(56, 139, 253, 0.1);
  border-left-color: #388bfd;
  color: #79c0ff;
}

.alert-success {
  background: rgba(46, 160, 67, 0.1);
  border-left-color: var(--success);
  color: var(--success);
}

.alert-warning {
  background: rgba(210, 153, 34, 0.1);
  border-left-color: var(--warning);
  color: var(--warning);
}

.alert-danger {
  background: rgba(248, 81, 73, 0.1);
  border-left-color: var(--danger);
  color: var(--danger);
}

/* ------------------------------------------------------------
   Providers Status Cards
   ------------------------------------------------------------ */
.providers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.provider-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.provider-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.provider-model {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  margin-bottom: 12px;
}

.provider-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}

.provider-status.configured {
  color: var(--success);
}

.provider-status.not-configured {
  color: var(--danger);
}

/* ------------------------------------------------------------
   Pagination
   ------------------------------------------------------------ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
}

.pagination .btn {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
}

.pagination .btn.active {
  background: var(--accent);
  color: #0d1117;
  font-weight: 600;
}

.pagination-info {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 8px;
}

/* ------------------------------------------------------------
   Utility Classes
   ------------------------------------------------------------ */
.hidden     { display: none !important; }
.sr-only    { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.text-dim   { color: var(--text-dim); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-mono  { font-family: var(--font-mono); }
.text-sm    { font-size: 12px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-600     { font-weight: 600; }
.mt-8       { margin-top: 8px; }
.mt-16      { margin-top: 16px; }
.mt-24      { margin-top: 24px; }
.mb-8       { margin-bottom: 8px; }
.mb-16      { margin-bottom: 16px; }
.mb-24      { margin-bottom: 24px; }
.flex       { display: flex; }
.flex-col   { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8      { gap: 8px; }
.gap-16     { gap: 16px; }
.w-full     { width: 100%; }

/* Scrollbar styling for content areas */
.content::-webkit-scrollbar,
#content::-webkit-scrollbar {
  width: 6px;
}

.content::-webkit-scrollbar-track,
#content::-webkit-scrollbar-track {
  background: transparent;
}

.content::-webkit-scrollbar-thumb,
#content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ------------------------------------------------------------
   Responsive â€” mobile sidebar collapse
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #main {
    margin-left: 0;
  }

  .hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
    background: none;
    border: none;
    margin-right: 8px;
  }

  .hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: all;
  }

  .login-card {
    padding: 28px 20px;
  }

  .message {
    max-width: 90%;
  }

  .nodes-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .modal {
    min-width: unset;
    padding: 20px;
  }

  table {
    font-size: 12px;
  }

  th, td {
    padding: 8px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

@media (min-width: 769px) {
  .hamburger {
    display: none;
  }

  .sidebar-backdrop {
    display: none;
  }
}
