/* ========================================
   AVDLData Demo Portal - Stylesheet
   Font: Inter | Theme: Dark (#08111f)
   Accent: #2563eb | Lines: #dbe4ef
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
  --bg:         #08111f;
  --bg-card:    #0c1929;
  --bg-input:   #111d2e;
  --ink:        #e8ecf1;
  --ink-dim:    #8899ad;
  --accent:     #2563eb;
  --accent-glow:#2563eb40;
  --line:       #dbe4ef20;
  --line-strong:#dbe4ef35;
  --success:    #22c55e;
  --warning:    #f59e0b;
  --danger:     #ef4444;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 4px 24px rgba(0,0,0,0.35);
  --font:       'Inter', system-ui, -apple-system, sans-serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color .2s;
}
a:hover {
  color: #3b82f6;
  text-decoration: underline;
}

/* --- Typography --- */
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 1.1rem;  font-weight: 600; }
p  { color: var(--ink-dim); }

/* --- Layout Helpers --- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* --- Card --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color .25s, box-shadow .25s;
}
.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

/* --- Button --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .65rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s;
}
.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover {
  background: #3b82f6;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--line);
}
.btn-ghost:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #dc2626;
}

/* --- Input --- */
.input {
  width: 100%;
  padding: .7rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--font);
  font-size: .9rem;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input::placeholder {
  color: var(--ink-dim);
}

/* --- Badge --- */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 9999px;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-active   { background: #22c55e20; color: var(--success); }
.badge-pending  { background: #f59e0b20; color: var(--warning); }
.badge-inactive { background: #ef444420; color: var(--danger); }

/* --- Navbar --- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
}

.navbar-brand svg {
  width: 28px;
  height: 28px;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: .5rem;
  list-style: none;
}

.navbar-nav a {
  padding: .4rem .8rem;
  border-radius: var(--radius-sm);
  color: var(--ink-dim);
  font-size: .85rem;
  font-weight: 500;
  transition: color .2s, background .2s;
}
.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--ink);
  background: var(--line);
  text-decoration: none;
}

/* --- Page Shell --- */
.page {
  padding: 2rem 0;
  min-height: calc(100vh - 56px);
}

.page-header {
  margin-bottom: 2rem;
}
.page-header h1 {
  margin-bottom: .3rem;
}

/* --- Error / Success Message --- */
.msg {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
  display: none;
}
.msg-error {
  background: #ef444415;
  color: var(--danger);
  border: 1px solid #ef444430;
  display: block;
}
.msg-success {
  background: #22c55e15;
  color: var(--success);
  border: 1px solid #22c55e30;
  display: block;
}

/* --- Chat Styling --- */
.chat-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-bubble {
  max-width: 75%;
  padding: .8rem 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  line-height: 1.5;
  animation: fadeIn .3s ease;
}
.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble.bot {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.chat-bubble.error {
  align-self: flex-start;
  background: #ef444415;
  border: 1px solid #ef444430;
  color: var(--danger);
}

.chat-input-bar {
  display: flex;
  gap: .5rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.chat-input-bar .input {
  flex: 1;
}

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

/* --- Iframe wrapper --- */
.iframe-wrapper {
  width: 100%;
  height: calc(100vh - 140px);
  border: none;
  border-radius: var(--radius);
  overflow: hidden;
}

/* --- Loading spinner --- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Mobile Menu Toggle --- */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--ink);
  font-size: 1.5rem;
  cursor: pointer;
  padding: .25rem;
}

@media (max-width: 640px) {
  .menu-toggle { display: block; }
  .navbar-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-card);
    border-bottom: 1px solid var(--line);
    padding: .5rem;
  }
  .navbar-nav.open { display: flex; }
  .navbar-nav a { padding: .75rem 1rem; }
  .chat-bubble { max-width: 90%; }
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-dim); }
