:root {
  --bg-color: #0f172a;
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  --text-primary: #f8fafc;
  --text-scnd: #94a3b8;
  --accent-physics: #ef4444;
  --accent-chemistry: #3b82f6;
  --accent-math: #8b5cf6;
  --accent-biology: #10b981;
  --accent-english: #f59e0b;
  --accent-humanities: #844d36;
  --accent-cs: #06b6d4;
  --accent-business: #64748b;
  --accent-economics: #10b981;
  --accent-gp: #f472b6;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-hover: rgba(255, 255, 255, 0.1);
  --glass-border: 1px solid rgba(255, 255, 255, 0.1);
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --font-family: 'Outfit', sans-serif;
  --radius: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
}

body {
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Background Globules */
.background-globule {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  opacity: 0.5;
  animation: float 20s infinite alternate ease-in-out;
}

.globule-1 {
  width: 400px;
  height: 400px;
  background: rgba(59, 130, 246, 0.3);
  top: -50px;
  left: -100px;
}

.globule-2 {
  width: 300px;
  height: 300px;
  background: rgba(239, 68, 68, 0.3);
  top: 20%;
  right: -50px;
  animation-delay: -5s;
}

.globule-3 {
  width: 500px;
  height: 500px;
  background: rgba(139, 92, 246, 0.2);
  bottom: -100px;
  left: 30%;
  animation-delay: -10s;
}

@keyframes float {
  0% {
    transform: translateY(0) scale(1);
  }

  100% {
    transform: translateY(-50px) scale(1.1);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }

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

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* Navbar */
.glass-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.logo-icon {
  font-size: 1.8rem;
  color: var(--accent-chemistry);
}

.primary-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
  color: white;
  padding: 0.75rem 1.75rem;
  border-radius: 12px;
  font-weight: 600;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.text-btn {
  background: transparent;
  border: none;
  color: var(--text-scnd);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.text-btn:hover {
  color: white;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3rem 2rem 2rem;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.gradient-text {
  background: linear-gradient(to right, #60a5fa, #a78bfa, #f472b6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero h1 .igcses {
  background: linear-gradient(90deg, #f472b6, #8b5cf6, #3b82f6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
  letter-spacing: -2px;
  filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.3));
}

.hero p {
  color: var(--text-scnd);
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

/* Search Bar */
.search-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  max-width: 600px;
  width: 90%;
  margin: 0 auto 1.5rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
}

.search-container ion-icon {
  font-size: 1.5rem;
  color: var(--text-scnd);
}

.search-container input {
  background: transparent;
  border: none;
  color: white;
  width: 100%;
  font-size: 1.1rem;
  outline: none;
  font-family: inherit;
}

.search-container input::placeholder {
  color: var(--text-scnd);
  opacity: 0.6;
}

.search-container:focus-within {
  border-color: #8b5cf6;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.highlight.physics {
  color: var(--accent-physics);
  font-weight: 600;
}

.highlight.chemistry {
  color: var(--accent-chemistry);
  font-weight: 600;
}

.highlight.all {
  color: var(--accent-math);
  font-weight: 600;
}

/* View Tabs */
.view-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  max-width: 300px;
  margin: 0 auto 1.5rem;
  border-radius: 50px;
  background: var(--glass-bg);
  border: var(--glass-border);
  backdrop-filter: blur(12px);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-scnd);
  padding: 0.75rem 1.25rem;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.95rem;
}

.tab-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.tab-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
}

/* Filter Controls */
.filter-controls {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: 50px;
  backdrop-filter: blur(12px);
  margin-top: 0.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.filter-btn {
  background: transparent;
  border: none;
  color: var(--text-scnd);
  padding: 0.6rem 1.1rem;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
  font-size: 0.9rem;
  white-space: nowrap;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.filter-btn.active {
  background: #8b5cf6;
  color: white;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 0.4rem;
}

.select-wrapper.compact {
  width: 120px;
}

.select-wrapper.compact .filter-select {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-scnd);
  text-align: center;
}

/* Notes Grid */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 1rem 4rem 4rem;
  max-width: 1600px;
  margin: 0 auto;
}

.note-card {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(16px);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.note-card:hover {
  transform: translateY(-5px);
  background: var(--glass-hover);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.subject-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.subject-badge.physics {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.subject-badge.chemistry {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.subject-badge.mathematics {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.subject-badge.biology {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.subject-badge.english_lang,
.subject-badge.english_lit {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.subject-badge.geography,
.subject-badge.history {
  background: rgba(132, 77, 54, 0.2);
  color: #dcbfa6;
  border: 1px solid rgba(132, 77, 54, 0.3);
}

.subject-badge.comp_sci {
  background: rgba(6, 182, 212, 0.2);
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.subject-badge.business {
  background: rgba(100, 116, 139, 0.2);
  color: #cbd5e1;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.subject-badge.economics {
  background: rgba(16, 185, 129, 0.2);
  color: #a7f3d0;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.subject-badge.gp {
  background: rgba(244, 114, 182, 0.2);
  color: #f9a8d4;
  border: 1px solid rgba(244, 114, 182, 0.3);
}

.delete-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.3);
  font-size: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  padding: 4px;
  border-radius: 50%;
}

.delete-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}


.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 0.5rem;
}

.card-meta {
  font-size: 0.9rem;
  color: var(--text-scnd);
  display: flex;
  gap: 1rem;
  margin-top: auto;
}

.download-btn {
  width: 100%;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 8px;
  color: white;
  margin-top: 1rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.download-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

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

.modal.active {
  display: flex;
}

.modal-content {
  background: #1e293b;
  width: 90%;
  max-width: 500px;
  padding: 2rem;
  border-radius: var(--radius);
  border: var(--glass-border);
  box-shadow: var(--shadow);
  position: relative;
  animation: modalPop 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes modalPop {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  cursor: pointer;
  color: var(--text-scnd);
  transition: 0.2s;
}

.close-modal:hover {
  color: white;
}

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

label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-scnd);
  font-size: 0.9rem;
}

input,
select {
  width: 100%;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: white;
  font-size: 1rem;
  outline: none;
  transition: 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #8b5cf6;
  background: rgba(0, 0, 0, 0.4);
}

textarea {
  width: 100%;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: white;
  font-size: 1rem;
  outline: none;
  transition: 0.2s;
  min-height: 100px;
  resize: vertical;
}

.card-description {
  font-size: 0.95rem;
  color: var(--text-scnd);
  line-height: 1.5;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.file-drop-area {
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: 0.2s;
}

.file-drop-area:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: #8b5cf6;
}

.file-drop-area ion-icon {
  font-size: 3rem;
  color: var(--text-scnd);
  margin-bottom: 1rem;
}

.submit-btn {
  width: 100%;
  padding: 1rem;
  background: #8b5cf6;
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: 0.2s;
}

.submit-btn:hover {
  background: #7c3aed;
}

/* Floating Action Button (FAB) */
.fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.4);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
}

.fab:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 15px 40px rgba(139, 92, 246, 0.5);
}

.fab ion-icon {
  margin-top: 2px;
}

.fab.loading {
  animation: rotate 2s linear infinite;
  pointer-events: none;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 768px) {
  .glass-nav {
    padding: 0.75rem 1rem;
    justify-content: space-between;
  }

  .logo span {
    font-size: 1.1rem;
  }

  .logo-icon {
    font-size: 1.25rem;
  }

  .fab {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 60px;
    height: 60px;
    font-size: 2rem;
  }

  .nav-actions {
    display: flex !important;
    gap: 0.75rem !important;
  }

  .secondary-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }

  /* Filter Scrolling */
  .filter-bar {
    display: flex;
    /* Changed from inline-flex */
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    justify-content: flex-start;
    padding: 0.75rem 1rem;
    border-radius: 0;
    margin: 0 -1rem;
    /* Full bleed on mobile padding context */
    width: calc(100% + 2rem);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .filter-bar::-webkit-scrollbar {
    display: none;
  }

  .filter-btn {
    flex-shrink: 0;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
  }

  /* Grid to List */
  .notes-grid {
    grid-template-columns: 1fr;
    padding: 1.5rem;
    gap: 1.5rem;
  }

  /* Dropdown width on mobile */
  .filter-row {
    flex-wrap: wrap;
    justify-content: center;
  }

  .select-wrapper.compact {
    width: 100%;
    margin-top: 0.5rem;
  }

  .divider {
    display: none;
  }

  /* Modal Full Screen */
  .modal {
    align-items: flex-end;
    /* Slide from bottom */
  }

  .modal-content {
    width: 100%;
    height: 85vh;
    /* Almost full height */
    max-width: none;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    padding: 2rem 1.5rem;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out forwards;
  }

  @keyframes slideUp {
    from {
      transform: translateY(100%);
      opacity: 0;
    }

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

  .close-modal {
    top: 1rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
  }
}