/* ================= DESIGN TOKENS ================= */

:root {
  --brand-1: #0b3d91;
  --brand-2: #04a9c3;
  --brand-3: #10b981;
  --bg-1: #0b2a3d;
  --bg-2: #123253;
  --bg-3: #0e4863;
  --bg-4: #1a6d8f;
  --surface: rgba(255, 255, 255, 0.07);
  --surface-strong: rgba(255, 255, 255, 0.14);
  --border-soft: rgba(255, 255, 255, 0.16);
  --text-main: #f2f7fa;
  --text-dim: #b8ccd8;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --success: #22c55e;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.4);
}

/* ================= RESET ================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", "Segoe UI", sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 10%, rgba(4, 169, 195, 0.25), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(16, 185, 129, 0.18), transparent 45%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2) 35%, var(--bg-3) 65%, var(--bg-4));
  background-size: 180% 180%;
  animation: bgMove 26s ease infinite;
  color: var(--text-main);
  padding-bottom: 60px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("https://www.transparenttextures.com/patterns/cubes.png");
  opacity: 0.06;
  pointer-events: none;
  z-index: -1;
}

@keyframes bgMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.4); }

/* ================= NAVBAR ================= */

.topnav {
  width: 100%;
  background: rgba(6, 20, 32, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 12px 0;
  margin-bottom: 28px;
  box-shadow: var(--shadow-soft);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-container {
  width: 94%;
  max-width: 1200px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  padding: 3px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.logo {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 1.15;
}

.logo small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.4px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-links a, .nav-links button {
  margin: 0;
}

.pill {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-soft);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ================= BUTTONS ================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border-soft);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.18);
}

.btn:active { transform: translateY(0); }

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: linear-gradient(90deg, var(--brand-2), #38d4e8);
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(4, 169, 195, 0.35);
}

.btn.primary:hover {
  box-shadow: 0 8px 22px rgba(4, 169, 195, 0.5);
}

.btn.danger {
  background: rgba(239, 68, 68, 0.85);
  border-color: transparent;
}

.btn.danger:hover {
  background: #ef4444;
}

.btn.small {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
}

.btn.block {
  width: 100%;
}

.btn.google {
  background: #fff;
  color: #1f2937;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.btn.google:hover {
  background: #f4f4f5;
}

/* ================= WRAPPERS ================= */

.wrapper {
  width: 94%;
  max-width: 1150px;
  margin: auto;
}

.card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 26px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
  animation: fadeIn 0.35s ease;
}

.card h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Auth Card */
.auth-wrap {
  display: flex;
  justify-content: center;
  margin-top: 48px;
  padding: 0 10px;
}

.auth-card {
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 34px 30px;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-pop);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
  animation: fadeIn 0.4s ease;
}

.auth-card .auth-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  text-align: center;
}

.auth-card .auth-head img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  padding: 4px;
}

.auth-card .auth-head h2 {
  font-size: 20px;
  font-weight: 800;
}

.auth-card .auth-head p {
  font-size: 13px;
  color: var(--text-dim);
}

.auth-card a {
  color: #7dd3ff;
  font-weight: 700;
  text-decoration: none;
}

.auth-card a:hover { text-decoration: underline; }

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  color: var(--text-dim);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}

/* ================= FORMS ================= */

.form label {
  display: block;
  margin-top: 18px;
  margin-bottom: 6px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-dim);
}

.form input,
.form textarea,
.form select {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  font-size: 14.5px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.form input::placeholder, .form textarea::placeholder {
  color: rgba(242, 247, 250, 0.45);
}

.form input:focus,
.form textarea:focus,
.form select:focus {
  outline: none;
  border-color: var(--brand-2);
  background: rgba(255, 255, 255, 0.12);
}

.form input:disabled,
.form textarea:disabled,
.form select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form select option { color: #111; }

.form textarea {
  height: 100px;
  resize: vertical;
}

.form button {
  margin-top: 22px;
}

/* ================= TABLE ================= */

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  overflow: hidden;
}

table th {
  text-align: left;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  padding: 12px 14px;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 700;
}

table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  font-size: 14px;
}

table tbody tr {
  transition: background 0.15s ease;
}

table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.06);
}

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

/* ================= BADGES ================= */

.badge {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
  color: white;
  display: inline-block;
  letter-spacing: 0.2px;
}

.badge.open { background: linear-gradient(90deg, #2563eb, #3b82f6); }
.badge.in_progress { background: linear-gradient(90deg, #d97706, #f59e0b); color: #1a1a1a; }
.badge.resolved { background: linear-gradient(90deg, #16a34a, #22c55e); }
.badge.rejected { background: linear-gradient(90deg, #dc2626, #ef4444); }

/* ================= EMPTY STATE ================= */

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-dim);
}

.empty-state .emoji {
  font-size: 42px;
  display: block;
  margin-bottom: 10px;
  opacity: 0.85;
}

.empty-state h3 {
  color: var(--text-main);
  font-size: 17px;
  margin-bottom: 6px;
}

/* ================= LOADING ================= */

.loading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 30px 10px;
  color: var(--text-dim);
  font-size: 14px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--brand-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.btn .spinner {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

/* ================= MODAL ================= */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 10, 16, 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.panel {
  width: 100%;
  max-width: 620px;
  background: rgba(20, 40, 55, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 28px;
  border-radius: var(--radius-lg);
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border-soft);
  color: #fff;
  box-shadow: var(--shadow-pop);
  animation: popIn 0.25s ease;
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.panel h3 {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 14px;
}

.panel h4 {
  font-size: 15px;
  font-weight: 700;
  margin: 16px 0 10px;
  color: var(--text-dim);
}

.panel hr {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 18px 0;
}

/* ================= TIMELINE ================= */

.timelineBox {
  background: rgba(255, 255, 255, 0.07);
  border-left: 3px solid var(--brand-2);
  padding: 10px 14px;
  margin: 8px 0;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-main);
  line-height: 1.6;
}

.timelineBox strong {
  color: #6ec8ff;
}

/* ================= MESSAGE / TOAST ================= */

.msg {
  margin-top: 12px;
  font-size: 13.5px;
  color: #9ad1ff;
  min-height: 18px;
}

.msg.error { color: #ff8a8a; }
.msg.success { color: #7ef2ac; }

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 320px;
}

.toast {
  background: rgba(15, 32, 45, 0.95);
  border: 1px solid var(--border-soft);
  border-left: 4px solid var(--info);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-pop);
  animation: slideIn 0.25s ease;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--info); }

.toast.hide {
  animation: slideOut 0.25s ease forwards;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(30px); }
}

/* ================= STAT CARDS ================= */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin: 18px 0 24px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.stat-card .num {
  font-size: 26px;
  font-weight: 800;
  display: block;
}

.stat-card .label {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-card.total .num { color: #60a5fa; }
.stat-card.open .num { color: #3b82f6; }
.stat-card.progress .num { color: #f59e0b; }
.stat-card.resolved .num { color: #22c55e; }
.stat-card.rejected .num { color: #ef4444; }

/* ================= CHAT ================= */

.chat-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-soft);
  padding: 12px;
  border-radius: var(--radius-sm);
  height: 280px;
  overflow-y: auto;
  margin-bottom: 12px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-bubble {
  padding: 8px 12px;
  border-radius: 10px;
  max-width: 85%;
  background: rgba(255, 255, 255, 0.1);
}

.chat-bubble.mine {
  align-self: flex-end;
  background: linear-gradient(90deg, rgba(4, 169, 195, 0.45), rgba(59, 130, 246, 0.35));
}

.chat-bubble .meta {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 3px;
}

.chat-input-row {
  display: flex;
  gap: 8px;
}

.chat-input-row input {
  flex: 1;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.chat-input-row input:focus {
  outline: none;
  border-color: var(--brand-2);
}

/* ================= SMALL / MISC ================= */

.small {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-dim);
}

/* ================= RESPONSIVE ================= */

@media (max-width: 700px) {
  .card { padding: 18px; }
  .logo { font-size: 15px; }
  .brand img { width: 25px; height: 25px; }

  .nav-container { flex-direction: column; align-items: flex-start; }
  .nav-links { width: 100%; }

  table { min-width: 640px; }
}

@media (max-width: 420px) {
  .auth-card { padding: 26px 20px; }
}
