:root {
  /* Light Theme Palette (Default) */
  --primary-hue: 250;
  --primary: hsl(var(--primary-hue), 80%, 60%);
  --primary-hover: hsl(var(--primary-hue), 85%, 55%);
  --primary-light: hsl(var(--primary-hue), 80%, 90%); /* Light purple background */

  --bg-app: #f9fafb;     /* Very light gray */
  --bg-card: #ffffff;    /* White */
  --bg-sidebar: #f3f4f6; /* Light gray */
  --bg-input: #ffffff;   /* White input */
  --bg-hover: rgba(0, 0, 0, 0.05); /* Hover state */
  --bg-overlay: rgba(0, 0, 0, 0.05); /* Overlay */

  --text-main: #111827;  /* Dark text */
  --text-muted: #6b7280; /* Gray text */
  --text-dim: #9ca3af;   /* Lighter gray */

  --border-color: #e5e7eb;
  --glass-bg: rgba(255, 255, 255, 0.8);

  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
}

/* Dark Mode Override */
body.dark-mode {
  --primary: hsl(var(--primary-hue), 80%, 65%);
  --primary-hover: hsl(var(--primary-hue), 85%, 60%);
  --primary-light: hsl(var(--primary-hue), 80%, 75%); /* Lighter text for dark mode */

  --bg-app: #0f1117;
  --bg-card: #1e2129;
  --bg-sidebar: #171920;
  --bg-input: #292c36;
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-overlay: rgba(255, 255, 255, 0.05);

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --border-color: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(30, 33, 41, 0.7);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

/* CSS Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s, color 0.3s;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  color: var(--text-main);
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary-hover);
}

/* Utilities */
.hidden { display: none !important; }

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}
body.dark-mode ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}
body.dark-mode ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Components: Inputs */
.input-field {
  width: 100%;
  padding: 12px 16px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.input-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input-field::placeholder {
  color: var(--text-dim);
}

/* Components: Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-size: 0.95rem;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 15px rgba(99, 102, 241, 0.4);
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid transparent;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* Auth Page Styling */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top right, #e0e7ff, #f3f4f6 40%);
}
body.dark-mode .auth-wrapper {
  background: radial-gradient(circle at top right, #2e1065, var(--bg-app) 40%);
}

.auth-container {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 3rem 2.5rem;
  border-radius: 24px;
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
  animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
body.dark-mode .auth-container {
  background: rgba(30, 33, 41, 0.8);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.auth-header h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(to right, var(--primary), var(--primary-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
body.dark-mode .auth-header h2 {
  background: linear-gradient(to right, #fff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-header p {
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-main);
  font-weight: 500;
}

.toggle-link {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 500px;
  animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  border: 1px solid var(--border-color);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.close-modal {
  cursor: pointer;
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: var(--text-muted);
  transition: all 0.2s;
}

.close-modal:hover {
  color: var(--text-main);
  transform: rotate(90deg) scale(1.1);
}

.modal-actions-right {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Tiny Icon Button for Copy, etc */
.btn-icon-tiny {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-icon-tiny:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.btn-icon-tiny i {
    transition: transform 0.2s ease;
}

.btn-icon-tiny:active i {
    transform: scale(0.9);
}

/* Premium Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-overlay);
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
    border-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(22px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}
