/* Variables & Themes */
:root {
  --bg-color: #0b0c10;
  --card-bg: rgba(20, 24, 38, 0.55);
  --border-color: rgba(255, 255, 255, 0.07);
  --text-color: #f1f3f9;
  --text-muted: #94a3b8;
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  --danger-color: #ef4444;
  --danger-hover: #dc2626;
  --success-color: #10b981;
  --transition-speed: 0.3s;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-x: hidden;
  position: relative;
}

/* Glowing background graphics */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.35;
  pointer-events: none;
}
.orb-1 { width: 400px; height: 400px; background: radial-gradient(circle, #4f46e5 0%, rgba(79,70,229,0) 70%); top: -10%; left: -10%; }
.orb-2 { width: 500px; height: 500px; background: radial-gradient(circle, #a855f7 0%, rgba(168,85,247,0) 70%); bottom: -10%; right: -10%; }
.orb-3 { width: 300px; height: 300px; background: radial-gradient(circle, #06b6d4 0%, rgba(6,182,212,0) 70%); top: 40%; left: 45%; }

h1, h2, h3 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

/* Header */
.app-header {
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  background: rgba(11, 12, 16, 0.4);
  backdrop-filter: blur(8px);
}

.logo { display: flex; align-items: center; gap: 0.5rem; }
.logo-icon {
  font-size: 1.5rem; color: var(--primary-color);
  text-shadow: 0 0 10px var(--primary-glow);
}
.logo-text {
  font-family: 'Outfit', sans-serif; font-size: 1.35rem; font-weight: 800;
  background: linear-gradient(135deg, #ffffff 30%, var(--primary-color) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* Sync status badge */
.connection-badge {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.8rem; border-radius: 50px;
  font-size: 0.8rem; font-weight: 500;
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.03);
}
.badge-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.connection-badge.connected { border-color: rgba(16,185,129,.2); background: rgba(16,185,129,.05); }
.connection-badge.connected .badge-dot { background-color: var(--success-color); box-shadow: 0 0 8px var(--success-color); }
.connection-badge.disconnected { border-color: rgba(239,68,68,.2); background: rgba(239,68,68,.05); }
.connection-badge.disconnected .badge-dot { background-color: var(--danger-color); box-shadow: 0 0 8px var(--danger-color); }

/* Containers */
.main-container {
  flex-grow: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 2.5rem 1rem;
}
.auth-card-wrapper, .dashboard-wrapper {
  display: none; width: 100%; max-width: 460px;
  animation: fadeIn 0.4s cubic-bezier(0.16,1,0.3,1) forwards;
}
.dashboard-wrapper { max-width: 860px; }
.auth-card-wrapper.active, .dashboard-wrapper.active { display: block; }

/* Cards & Layout */
.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px; padding: 2.5rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.card-header { margin-bottom: 2rem; text-align: center; }
.card-header h1 { font-size: 1.85rem; margin-bottom: 0.4rem; }
.card-header p { color: var(--text-muted); font-size: 0.92rem; }

/* Dev mode details */
.dev-hint {
  display: flex; align-items: center; gap: 0.5rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fcd34d; border-radius: 8px;
  padding: 0.75rem 1rem; font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.otp-sent-msg {
  color: var(--text-muted); font-size: 0.9rem;
  margin-bottom: 1.5rem; text-align: center;
}
.otp-sent-msg strong { color: #fff; }

/* Error box */
.error-container {
  display: none;
  background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.25);
  color: #fca5a5; padding: 0.8rem 1rem; border-radius: 8px;
  font-size: 0.85rem; margin-bottom: 1.5rem;
  line-height: 1.4; animation: shake 0.3s;
}

/* Inputs & Forms */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.5rem; color: #cbd5e1; }
.input-wrapper { position: relative; display: flex; align-items: center; }
.input-icon { position: absolute; left: 1rem; color: var(--text-muted); pointer-events: none; font-size: 1.1rem; }

.input-wrapper input {
  width: 100%; min-height: 46px;
  padding: 0.75rem 1rem 0.75rem 2.8rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; color: #ffffff; font-size: 0.95rem;
  transition: all var(--transition-speed); outline: none;
}
.input-wrapper input:focus {
  border-color: var(--primary-color); background: rgba(255,255,255,0.05);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.password-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.4rem; padding-left: 0.2rem; }

/* Primary Button */
.btn-primary {
  width: 100%; min-height: 46px;
  background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
  color: #fff; border: none; border-radius: 10px;
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: all var(--transition-speed);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #6d28d9 100%);
  box-shadow: 0 6px 18px var(--primary-glow);
}
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.spinner {
  display: none; width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3); border-radius: 50%;
  border-top-color: #fff; animation: spin 0.8s linear infinite;
}
.btn-primary.loading .spinner { display: inline-block; }
.btn-primary.loading .btn-text { display: none; }

.link-btn {
  background: none; border: none; color: var(--primary-color);
  font-weight: 500; cursor: pointer; transition: color var(--transition-speed);
}
.link-btn:hover { color: var(--primary-hover); text-decoration: underline; }

/* Dashboard Design */
.dashboard-card { padding: 2.5rem; }
.dashboard-header {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border-color); padding-bottom: 1.5rem; margin-bottom: 2rem;
}
.user-meta { display: flex; align-items: center; gap: 1.25rem; }
.user-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color) 0%, #ec4899 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1.35rem; color: #fff;
  box-shadow: 0 4px 15px rgba(99,102,241,.25);
}
.profile-role { font-size: 0.85rem; color: var(--primary-color); font-weight: 600; text-transform: uppercase; margin-top: 0.2rem; }

.btn-danger {
  padding: 0.5rem 1.2rem;
  background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.2);
  border-radius: 8px; color: #fca5a5; font-weight: 500; cursor: pointer;
  transition: all var(--transition-speed);
}
.btn-danger:hover { background: var(--danger-color); border-color: var(--danger-color); color: #fff; }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 2rem; margin-bottom: 2rem; }
.info-card { background: rgba(255,255,255,0.015); border: 1px solid var(--border-color); border-radius: 12px; padding: 1.5rem; }
.info-card h3 { font-size: 1.05rem; margin-bottom: 1rem; color: #fff; border-bottom: 1px solid rgba(255,255,255,0.04); padding-bottom: 0.5rem; }

.details-list { list-style: none; }
.details-list li { display: flex; justify-content: space-between; align-items: center; padding: 0.7rem 0; border-bottom: 1px solid rgba(255,255,255,.02); }
.details-list li:last-child { border-bottom: none; }
.details-label { color: var(--text-muted); font-size: 0.88rem; }
.details-value { font-weight: 500; font-size: 0.92rem; text-align: right; }

/* Custom Radio selector options */
.role-selector-options { display: flex; flex-direction: column; gap: 0.75rem; }
.role-option { cursor: pointer; display: block; }
.role-option input { display: none; }

.role-card-inner {
  display: grid; grid-template-columns: auto 1fr;
  grid-template-areas: 
    "icon title"
    "icon desc";
  column-gap: 1rem; row-gap: 0.15rem;
  padding: 0.8rem 1rem; border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255,255,255,0.06);
  transition: all var(--transition-speed);
}
.role-option input:checked + .role-card-inner {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
}
.role-icon { grid-area: icon; align-self: center; font-size: 1.4rem; }
.role-title { grid-area: title; font-weight: 600; font-size: 0.9rem; color: #ffffff; }
.role-desc { grid-area: desc; font-size: 0.78rem; color: var(--text-muted); }

/* Activity container */
.activity-log h3 { font-size: 1.05rem; margin-bottom: 0.75rem; }
.activity-container {
  background: rgba(0,0,0,.15); border: 1px solid var(--border-color);
  border-radius: 12px; padding: 1rem; max-height: 150px; overflow-y: auto;
}
.activity-item { display: flex; align-items: center; gap: 1rem; padding: 0.5rem; border-bottom: 1px solid rgba(255,255,255,.02); font-size: 0.85rem; }
.activity-item:last-child { border-bottom: none; }
.activity-time { color: var(--text-muted); font-family: monospace; }
.activity-text { color: #cbd5e1; }
.activity-item.system .activity-text { color: #93c5fd; }
.activity-item.auth-success .activity-text { color: #86efac; }

/* Footer */
.app-footer { padding: 1.25rem; text-align: center; font-size: 0.8rem; color: var(--text-muted); border-top: 1px solid var(--border-color); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Responsive adjustments */
@media (max-width: 680px) {
  .dashboard-grid { grid-template-columns: 1fr; gap: 1.25rem; }
  .glass-card { padding: 1.5rem; }
}
