/*
 * ╔══════════════════════════════════════════════════════════════╗
 * ║  XEYROSHEN — Your Own AI Model                              ║
 * ║  Codename: Rewire                                            ║
 * ║  © Adeshjeet_Official 2025 — All Rights Reserved            ║
 * ║  File: css/styles.css — Global Base Styles                  ║
 * ╚══════════════════════════════════════════════════════════════╝
 */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family:        var(--font-body);
  background-color:   var(--bg-primary);
  color:              var(--text-primary);
  line-height:        1.6;
  min-height:         100%;
  overflow-x:         hidden;
  -webkit-font-smoothing:  antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button, input, textarea, select {
  font-family: inherit;
  font-size:   inherit;
}

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

/* ─── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family:  var(--font-display);
  font-weight:  700;
  line-height:  1.2;
  color:        var(--text-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

p {
  color:       var(--text-secondary);
  line-height: 1.7;
}

code, kbd, pre {
  font-family: var(--font-mono);
  font-size:   0.875em;
}

code {
  background: var(--code-bg);
  color:      var(--code-text);
  padding:    2px 6px;
  border-radius: var(--radius-sm);
  border:     1px solid var(--code-border);
}

pre {
  background:    var(--code-bg);
  border:        1px solid var(--code-border);
  border-radius: var(--radius-md);
  padding:       var(--space-4);
  overflow-x:    auto;
  position:      relative;
}

pre code {
  background:    transparent;
  border:        none;
  padding:       0;
  font-size:     0.85rem;
  color:         var(--text-primary);
}

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar               { width: 5px; height: 5px; }
::-webkit-scrollbar-track         { background: var(--scroll-track); }
::-webkit-scrollbar-thumb         { background: var(--scroll-thumb); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover   { background: var(--accent); }

/* ─── Selection ──────────────────────────────────────────────── */
::selection {
  background: var(--accent-dim);
  color:      var(--accent);
}

/* ─── Focus Ring ─────────────────────────────────────────────── */
:focus-visible {
  outline:        2px solid var(--accent);
  outline-offset: 2px;
  border-radius:  var(--radius-sm);
}

/* ─── Layout Utilities ────────────────────────────────────────── */
.container {
  width:      100%;
  max-width:  1100px;
  margin:     0 auto;
  padding:    0 var(--space-6);
}

.flex            { display: flex; }
.flex-col        { display: flex; flex-direction: column; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.items-end       { align-items: flex-end; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.flex-1          { flex: 1; }
.flex-wrap       { flex-wrap: wrap; }
.gap-1           { gap: var(--space-1); }
.gap-2           { gap: var(--space-2); }
.gap-3           { gap: var(--space-3); }
.gap-4           { gap: var(--space-4); }
.gap-6           { gap: var(--space-6); }
.grid            { display: grid; }

/* ─── Spacing Utilities ──────────────────────────────────────── */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

/* ─── Text Utilities ─────────────────────────────────────────── */
.text-sm      { font-size: 0.875rem; }
.text-xs      { font-size: 0.75rem; }
.text-lg      { font-size: 1.125rem; }
.text-muted   { color: var(--text-muted); }
.text-accent  { color: var(--accent); }
.text-center  { text-align: center; }
.font-mono    { font-family: var(--font-mono); }
.font-display { font-family: var(--font-display); }
.font-bold    { font-weight: 700; }
.font-medium  { font-weight: 500; }
.truncate     { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ─── Visibility ─────────────────────────────────────────────── */
.hidden        { display: none !important; }
.invisible     { visibility: hidden; }
.sr-only       {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ─── Divider ─────────────────────────────────────────────────── */
.divider {
  width:      100%;
  height:     1px;
  background: var(--border);
  margin:     var(--space-4) 0;
}

/* ─── Badge ──────────────────────────────────────────────────── */
.badge {
  display:       inline-flex;
  align-items:   center;
  gap:           var(--space-1);
  padding:       3px 10px;
  border-radius: var(--radius-pill);
  font-size:     0.7rem;
  font-weight:   600;
  font-family:   var(--font-mono);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-accent  { background: var(--accent-dim);   color: var(--accent); }
.badge-success { background: var(--success-dim);  color: var(--success); }
.badge-warning { background: var(--warning-dim);  color: #b8860b; }
.badge-danger  { background: var(--danger-dim);   color: var(--danger); }
.badge-info    { background: var(--info-dim);     color: var(--info); }

/* ─── Avatar ──────────────────────────────────────────────────── */
.avatar {
  width:         40px;
  height:        40px;
  border-radius: var(--radius-pill);
  background:    var(--accent-dim);
  color:         var(--accent);
  display:       flex;
  align-items:   center;
  justify-content: center;
  font-family:   var(--font-display);
  font-weight:   700;
  font-size:     1rem;
  flex-shrink:   0;
  border:        1px solid var(--border-accent);
}

/* ─── Glassmorphism Panel ────────────────────────────────────── */
.glass {
  background:     var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border:         1px solid var(--border);
  border-radius:  var(--radius-lg);
}

/* ─── Card ────────────────────────────────────────────────────── */
.card {
  background:    var(--surface-1);
  border:        1px solid var(--border);
  border-radius: var(--radius-lg);
  padding:       var(--space-6);
  box-shadow:    var(--shadow-sm);
}

/* ─── Status Dot ─────────────────────────────────────────────── */
.status-dot {
  width:         8px;
  height:        8px;
  border-radius: 50%;
  flex-shrink:   0;
}
.status-dot.online  { background: var(--success); box-shadow: 0 0 0 3px var(--success-dim); }
.status-dot.offline { background: var(--text-muted); }
.status-dot.busy    { background: var(--warning); }

/* ─── Thinking Dots (AI processing) ─────────────────────────── */
.thinking-dots {
  display:     inline-flex;
  gap:         4px;
  align-items: center;
}
.thinking-dots span {
  width:         6px;
  height:        6px;
  border-radius: 50%;
  background:    var(--accent);
  animation:     thinkPulse 1.4s infinite ease-in-out;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinkPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1.1); opacity: 1;   }
}

/* ─── Xeyroshen Logo Text ─────────────────────────────────────── */
.logo-text {
  font-family:    var(--font-display);
  font-weight:    800;
  letter-spacing: -0.04em;
  background:     linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Global Page Wrapper ────────────────────────────────────── */
.page-wrapper {
  min-height: 100vh;
  background: var(--bg-primary);
  display:    flex;
  flex-direction: column;
}

/* ─── Toast / Notification ────────────────────────────────────── */
#toast-container {
  position:  fixed;
  bottom:    var(--space-6);
  right:     var(--space-6);
  z-index:   9999;
  display:   flex;
  flex-direction: column;
  gap:       var(--space-3);
}

.toast {
  background:    var(--surface-2);
  border:        1px solid var(--border);
  border-radius: var(--radius-md);
  padding:       var(--space-3) var(--space-4);
  box-shadow:    var(--shadow-lg);
  font-size:     0.875rem;
  color:         var(--text-primary);
  display:       flex;
  align-items:   center;
  gap:           var(--space-3);
  min-width:     260px;
  max-width:     380px;
  animation:     slideInRight 0.3s var(--transition-bounce) forwards;
}
.toast.removing {
  animation: slideOutRight 0.25s ease-in forwards;
}
.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger);  }
.toast.info    { border-left: 3px solid var(--accent);  }

@keyframes slideInRight {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes slideOutRight {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(110%); opacity: 0; }
}

/* ─── Modal Overlay ──────────────────────────────────────────── */
.modal-overlay {
  position:   fixed;
  inset:      0;
  background: var(--bg-overlay);
  z-index:    1000;
  display:    flex;
  align-items:   center;
  justify-content: center;
  padding:    var(--space-4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease forwards;
}
.modal {
  background:    var(--surface-1);
  border:        1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding:       var(--space-8);
  width:         100%;
  max-width:     480px;
  box-shadow:    var(--shadow-lg);
  animation:     scaleIn 0.25s var(--transition-bounce) forwards;
}
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .container { padding: 0 var(--space-4); }
  .card      { padding: var(--space-4); }
}
