:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-primary: #10b981;
  --accent-secondary: #059669;
  --danger: #ef4444;
  --border: #334155;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-main: 'Inter', sans-serif;
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* Auth Layout */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top right, #1e293b, #0f172a);
}

.auth-card {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(10px);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent-primary);
}

/* Dashboard Layout */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  color: var(--accent-primary);
  font-size: 1.25rem;
}

.nav-links {
  list-style: none;
  padding: 1rem 0;
  flex-grow: 1;
}

.nav-item a {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.nav-item a:hover, .nav-item a.active {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-left: 3px solid var(--accent-primary);
}

.main-content {
  flex-grow: 1;
  padding: 2rem;
  overflow-y: auto;
  height: 100vh;
}

.page-header {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
}

/* Cards */
.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-family: inherit;
  font-size: 0.875rem;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--accent-secondary);
}

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

.btn-block {
  width: 100%;
}

/* Tables */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
}

/* Utils */
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-4 { gap: 1rem; }
.mt-4 { margin-top: 1rem; }

/* Toast */
#toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 50;
}

.toast {
  background-color: var(--bg-secondary);
  border-left: 4px solid var(--accent-primary);
  color: var(--text-primary);
  padding: 1rem;
  margin-top: 0.5rem;
  border-radius: 4px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease-out forwards;
}

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

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

/* QR Code Container */
#qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: #fff;
  border-radius: var(--radius-md);
  max-width: 300px;
  margin: 0 auto;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-connected {
  background-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.status-disconnected {
  background-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* Documentation Styling */
.docs-layout {
  display: flex;
  min-height: 100vh;
  background-color: #0b0f19;
}

.docs-sidebar {
  width: 280px;
  background-color: #111827;
  border-right: 1px solid var(--border);
  padding: 2rem 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.docs-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.docs-nav-group-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.docs-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.docs-nav-link {
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: color 0.2s;
  display: block;
  padding: 0.25rem 0;
}

.docs-nav-link:hover {
  color: var(--text-primary);
}

.docs-content {
  flex-grow: 1;
  padding: 3rem 4rem;
  max-width: 900px;
  margin: 0 auto;
}

.docs-section {
  margin-bottom: 4rem;
  scroll-margin-top: 2rem;
}

.docs-section h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.docs-section h3 {
  font-size: 1.25rem;
  font-weight: 500;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.docs-section p {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  line-height: 1.7;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.docs-table th, .docs-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.docs-table th {
  color: var(--text-primary);
  background-color: rgba(30, 41, 59, 0.4);
  font-weight: 600;
  font-size: 0.875rem;
}

.docs-table td {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.docs-code-badge {
  background-color: #1e293b;
  color: #38bdf8;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85rem;
}

.docs-method {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.75rem;
  margin-right: 0.5rem;
  font-family: monospace;
}

.docs-method.get {
  background-color: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}

.docs-method.post {
  background-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.docs-code-wrapper {
  position: relative;
  background-color: #111827;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.docs-code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background-color: #1f2937;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.docs-code-copy {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.75rem;
  transition: color 0.2s;
}

.docs-code-copy:hover {
  color: var(--text-primary);
}

.docs-code-content {
  padding: 1rem;
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.875rem;
  color: #f3f4f6;
  white-space: pre;
}

.docs-tab-container {
  margin-bottom: 1.5rem;
}

.docs-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background-color: #1f2937;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.docs-tab {
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border: none;
  background: none;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.docs-tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  background-color: rgba(31, 41, 55, 0.5);
}

.docs-tab-content {
  display: none;
}

.docs-tab-content.active {
  display: block;
}

/* Responsive Docs */
@media (max-width: 768px) {
  .docs-layout {
    flex-direction: column;
  }
  
  .docs-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-bottom: 1px solid var(--border);
    border-right: none;
  }
  
  .docs-content {
    padding: 2rem;
  }
}

