:root {
  /* Color Palette - Synchronized with Logo */
  --primary: #22d3ee;
  /* Cyan/Blue from logo glow */
  --primary-hover: #0891b2;
  --secondary: #4ade80;
  /* Green from logo glow */
  --bg-dark: #0a0c10;
  /* Deep charcoal/Black from logo background */
  --sidebar-bg: rgba(10, 12, 16, 0.85);
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-heavy: rgba(10, 12, 16, 0.95);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --favorite: #facc15;

  /* UI Tokens */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  background-color: var(--bg-dark);
  background-image:
    radial-gradient(circle at top right, rgba(34, 211, 238, 0.05), transparent 400px);
  color: var(--text-main);
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
}

/* Auth Screens */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-container.split-layout {
  padding: 0;
  flex-direction: row;
  width: 100%;
  flex: 1;
}

.auth-left {
  flex: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  position: relative;
  min-height: 100vh;
  background: radial-gradient(circle at 70% 50%, rgba(34, 211, 238, 0.1), transparent 500px);
}

.auth-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  min-height: 100vh;
  border-left: 1px solid var(--glass-border);
}

.auth-logo-large img {
  max-width: 800px;
  width: 100%;
  height: auto;
  animation: logoFloat 6s ease-in-out infinite;
}

@keyframes logoFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-15px);
  }
}

.auth-card {
  background: var(--glass-heavy);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  padding: 3rem;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 450px;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.6s ease-out;
}

.alert {
  padding: 14px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-size: 0.9rem;
  border-width: 1px;
  border-style: solid;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.2);
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.2);
}

.auth-card h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  text-align: center;
}

.auth-card p {
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: white;
  font-size: 1rem;
  transition: var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.1);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border: none;
  color: #0a0c10;
  padding: 14px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(34, 211, 238, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(34, 211, 238, 0.4);
}

.auth-footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

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

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(15px);
  border-right: 1px solid var(--glass-border);
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: 24px;
  z-index: 100;
}

.sidebar-logo {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  margin-bottom: 2.5rem;
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: 8px;
}

.nav-menu {
  flex: 1;
  list-style: none;
}

.nav-item {
  margin-bottom: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.nav-link.active {
  background: rgba(34, 211, 238, 0.1);
  color: var(--primary);
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--glass-border);
  padding-top: 20px;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: transparent;
  border: none;
  padding: 12px 16px;
  color: #ef4444;
  cursor: pointer;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: var(--transition);
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.05);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

.page-title h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 700;
}

.btn-new-note {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #0a0c10;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-new-note:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 15px -3px rgba(34, 211, 238, 0.4);
}

/* Note Grid */
.note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.note-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  transition: var(--transition);
  cursor: pointer;
  overflow: hidden;
}

.note-card:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.note-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: white;
  font-family: 'Outfit', sans-serif;
}

.note-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-footer {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.note-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.fav-btn {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.fav-btn.active {
  color: var(--favorite);
  text-shadow: 0 0 10px rgba(250, 204, 21, 0.4);
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  /* Controlled by JS */
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-dark);
  border: 1px solid var(--glass-border);
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius-xl);
  padding: 32px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Notebook View Styling (OneNote Style) */
.modal-notebook {
  max-width: 95vw;
  height: 90vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notebook-header {
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--glass-heavy);
}

.notebook-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.notebook-sidebar {
  width: 300px;
  background: rgba(0, 0, 0, 0.2);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 1rem;
}

.pages-list {
  flex: 1;
  overflow-y: auto;
  margin-top: 1rem;
}

.page-item {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
}

.page-item:hover {
  background: var(--glass);
  color: white;
}

.page-item.active {
  background: rgba(34, 211, 238, 0.1);
  color: var(--primary);
  font-weight: 600;
}

.btn-add-page {
  width: 100%;
  padding: 10px;
  background: var(--glass);
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-add-page:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.notebook-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2rem;
  background: var(--bg-dark);
}

.page-title-input {
  font-family: 'Outfit';
  font-size: 2.5rem;
  font-weight: 700;
  background: transparent;
  border: none;
  color: white;
  margin-bottom: 1.5rem;
  width: 100%;
  outline: none;
}

.page-content-area {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1.1rem;
  line-height: 1.6;
  resize: none;
  outline: none;
  width: 100%;
  overflow-y: auto;
  padding: 10px 0;
}

.page-content-area:empty:before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  font-style: italic;
}

/* Toolbar Styling */
.editor-toolbar {
  display: flex;
  gap: 8px;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  flex-wrap: wrap;
}

.toolbar-btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

.toolbar-btn.active {
  background: var(--primary);
  color: var(--bg-dark);
}

.toolbar-select {
  background: var(--bg-dark);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  outline: none;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 992px) {
  .auth-container.split-layout {
    flex-direction: column;
    padding: 40px 20px;
  }

  .auth-left {
    padding: 20px;
    flex: none;
  }

  .auth-right {
    padding: 20px;
    border-left: none;
    flex: none;
  }

  .auth-logo-large img {
    max-width: 280px;
  }
}

@media (max-width: 768px) {
  .dashboard-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding: 12px;
  }

  .sidebar-logo {
    margin-bottom: 0;
    margin-right: 20px;
    font-size: 1rem;
  }

  .nav-menu {
    display: flex;
    gap: 8px;
    flex: 0;
  }

  .sidebar-footer {
    margin-top: 0;
    border: none;
    padding-top: 0;
  }

  .logout-btn {
    padding: 8px;
  }

  .main-content {
    padding: 20px;
  }
}