/* ============================================================
   CottonKapua.AI — Multi-Cloud DevOps Platform
   style.css
   Built by Rajveer & Team
   ============================================================ */

:root {
  --bg:          #f0f2f5;
  --surface:     #ffffff;
  --surface2:    #f8fafc;
  --border:      #e2e8f0;
  --text:        #0f172a;
  --muted:       #64748b;
  --hint:        #94a3b8;
  --accent:      #0ea5e9;
  --accent-dark: #0284c7;
  --success-bg:  #dcfce7; --success-txt: #15803d;
  --warning-bg:  #fef3c7; --warning-txt: #b45309;
  --danger-bg:   #fee2e2; --danger-txt:  #b91c1c;
  --info-bg:     #e0f2fe; --info-txt:    #0369a1;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
}

body.dark {
  --bg:          #0a0f1e;
  --surface:     #111827;
  --surface2:    #1a2236;
  --border:      #1f2d45;
  --text:        #f1f5f9;
  --muted:       #94a3b8;
  --hint:        #475569;
  --accent:      #38bdf8;
  --accent-dark: #0ea5e9;
  --success-bg:  #052e16; --success-txt: #4ade80;
  --warning-bg:  #1c0a00; --warning-txt: #fbbf24;
  --danger-bg:   #1c0505; --danger-txt:  #f87171;
  --info-bg:     #082039; --info-txt:    #38bdf8;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  transition: background 0.25s, color 0.25s;
}

/* ── HEADER ─────────────────────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}

.header-left  { display: flex; align-items: center; gap: 14px; }
.header-right { display: flex; align-items: center; gap: 10px; }

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.logo-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.logo-ai {
  color: var(--accent);
  font-weight: 800;
}

.logo-tagline {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

.pill {
  font-size: 11px;
  background: var(--info-bg);
  color: var(--info-txt);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.badge-live {
  font-size: 11px;
  background: var(--success-bg);
  color: var(--success-txt);
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

/* Search */
.search-wrap {
  position: relative;
}
.search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search-wrap input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px 10px 7px 30px;
  font-size: 12px;
  color: var(--text);
  width: 180px;
  outline: none;
  transition: border-color 0.2s;
}
.search-wrap input:focus { border-color: var(--accent); }
.search-wrap input::placeholder { color: var(--hint); }

/* Icon button */
.icon-btn {
  position: relative;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px 10px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  transition: border-color 0.2s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

.notif-dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 7px; height: 7px;
  background: #ef4444;
  border-radius: 50%;
  border: 1px solid var(--surface);
}

/* Profile button */
.profile-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 5px 10px 5px 6px;
  cursor: pointer;
  color: var(--muted);
  transition: border-color 0.2s;
}
.profile-btn:hover { border-color: var(--accent); }

.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
}

.profile-name { font-size: 12px; color: var(--text); font-weight: 500; }

/* Dropdown panels */
.notif-wrap, .profile-wrap { position: relative; }

.dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-width: 220px;
  z-index: 300;
  padding: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.dropdown-panel.open { display: block; }

.panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 2px 4px 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.notif-item {
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-msg { font-size: 12px; color: var(--text); }
.notif-time { font-size: 11px; color: var(--hint); margin-top: 2px; }

.panel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.panel-item:hover { background: var(--surface2); }
.panel-item.danger { color: var(--danger-txt); }
.panel-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Theme toggle */
.theme-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.toggle-btn {
  width: 38px; height: 21px;
  background: var(--border);
  border-radius: 20px;
  border: none;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-btn.on { background: var(--accent); }
.toggle-btn::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 15px; height: 15px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.2s;
}
.toggle-btn.on::after { left: 20px; }

/* ── MAIN ────────────────────────────────────────────────── */
.main {
  padding: 24px;
  max-width: 1280px;
  margin: 0 auto;
}

/* ── STAT CARDS ──────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-val {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -1px;
}

.stat-sub { font-size: 11px; margin-top: 5px; }
.s-green { color: var(--success-txt); }
.s-orange { color: var(--warning-txt); }
.s-red { color: var(--danger-txt); }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

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

/* ── GRID 2 COL ──────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

/* ── CHARTS ──────────────────────────────────────────────── */
.chart-h  { position: relative; height: 190px; }
.chart-hw { position: relative; height: 165px; }

/* ── TASK MANAGER ────────────────────────────────────────── */
.task-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-filter {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-filter:hover, .btn-filter.active {
  background: var(--info-bg);
  color: var(--info-txt);
  border-color: var(--info-txt);
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}

/* Table */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* Badges */
.badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}
.b-s { background: var(--success-bg); color: var(--success-txt); }
.b-w { background: var(--warning-bg); color: var(--warning-txt); }
.b-d { background: var(--danger-bg);  color: var(--danger-txt);  }
.b-i { background: var(--info-bg);    color: var(--info-txt);    }

/* System message */
.sys-msg {
  font-size: 12px;
  color: var(--success-txt);
  background: var(--success-bg);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
  display: none;
  border-left: 3px solid var(--success-txt);
}

/* ── SERVICE ROWS ─────────────────────────────────────────── */
.svc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.svc-row:last-child { border-bottom: none; }
.svc-name { display: flex; align-items: center; gap: 8px; color: var(--text); }

/* Deploy rows */
.dep-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.dep-row:last-child { border-bottom: none; }

/* ── INFRA GRID ───────────────────────────────────────────── */
.infra-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 600px) { .infra-grid { grid-template-columns: 1fr; } }

.infra-card {
  background: var(--surface2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}
.infra-card:hover { border-color: var(--accent); }
.infra-icon { font-size: 28px; line-height: 1; }
.infra-provider { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.infra-service  { font-size: 13px; font-weight: 600; color: var(--text); margin-top: 2px; }

/* ── FOOTER ───────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--hint);
  background: var(--surface);
  gap: 16px;
  flex-wrap: wrap;
}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.footer-credit { color: var(--accent); font-weight: 700; }

/* ── MODAL ────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 400;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px;
  width: 380px;
  border: 1px solid var(--border);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text); }
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--surface2); }

.form-group { margin-bottom: 14px; }
.form-group label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  display: block;
  margin-bottom: 5px;
}
.form-group input,
.form-group select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus { border-color: var(--accent); }

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