/* Dashboard Styles */
:root {
  --primary-color: #8b5cf6;
  --secondary-color: #06b6d4;
  --accent-color: #f43f5e;
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --background-dark: #0a0e27;
  --background-light: #1a1f3a;
  --background-card: rgba(30, 41, 59, 0.85);
  --text-color: #ffffff;
  --text-muted: #cbd5e1;
  --danger-color: #ef4444;
  --border-color: rgba(148, 163, 184, 0.2);
  --glass-border: rgba(255, 255, 255, 0.15);
}

@keyframes animated-gradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.3); }
  50% { box-shadow: 0 0 40px rgba(139, 92, 246, 0.6); }
}

@keyframes rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

body {
  background-color: var(--background-dark);
  background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0f172a 100%);
  background-size: 400% 400%;
  animation: animated-gradient 15s ease infinite;
  min-height: 100vh;
  margin: 0;
  font-family: 'Google Sans', 'Segoe UI', 'Arial', sans-serif;
  color: var(--text-color);
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(6, 182, 212, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(244, 63, 94, 0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Content Cards */
.th-card {
  background: var(--background-card);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.8rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.th-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(139, 92, 246, 0.2);
}

.th-card-header {
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.7em;
  margin-bottom: 1.2rem;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.th-card p {
  line-height: 1.8;
  color: var(--text-muted);
  font-size: 1.05rem;
  font-weight: 400;
}

/* Navbar */
.dashboard-navbar {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  padding: 1rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
  overflow: visible;
}

.dashboard-navbar .brand {
  font-size: 1.6rem;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  letter-spacing: 0.5px;
}

.dashboard-navbar .logout-btn {
  display: flex;
  align-items: center;
  gap: 0.6em;
  background: linear-gradient(135deg, var(--danger-color), #dc2626);
  color: white;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  padding: 0.7em 1.5em;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
  transition: all 0.3s ease;
  text-decoration: none;
}

.dashboard-navbar .logout-btn:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: 0 6px 25px rgba(239, 68, 68, 0.5);
  transform: translateY(-2px);
}

/* Main Container */
.dashboard-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 2rem;
  position: relative;
  z-index: 1;
}

/* Profile Card */
.profile-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  background: var(--background-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.profile-card::before {
  content: '';
  position: absolute;
  top: -25%;
  left: -25%;
  width: 150%;
  height: 150%;
  background: conic-gradient(from 180deg at 50% 50%, transparent, rgba(0, 255, 65, 0.2), transparent 35%);
  animation: rotate 10s linear infinite;
  pointer-events: none;
  opacity: 0.5;
  z-index: -1;
}

.user-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 25px rgba(0, 255, 65, 0.5);
  border: 3px solid var(--primary-color);
  transition: transform 0.3s ease;
}

.user-avatar:hover {
  transform: scale(1.1);
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: 0.75em;
}

.user-email {
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 0.25rem;
  word-break: break-all;
}

#edit-name-btn,
#delete-account-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

#edit-name-btn:hover {
  background-color: var(--primary-color);
  color: var(--background-dark);
  border-color: var(--primary-color);
}

.profile-actions {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  gap: 0.5rem;
}

#delete-account-btn:hover {
  background-color: var(--danger-color);
  color: var(--text-color);
  border-color: var(--danger-color);
}

#edit-profile-form {
  display: none;
  margin-top: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 1.5em;
  max-width: 450px;
}

#edit-profile-form label {
  display: block;
  color: var(--primary-color);
  font-size: 0.9em;
  margin-bottom: 0.3em;
}

#edit-profile-form input {
  width: 100%;
  padding: 0.5em 0.7em;
  border-radius: 6px;
  border: 1px solid var(--primary-color);
  font-size: 1em;
  background: var(--background-light);
  color: #fff;
  box-sizing: border-box;
}

#edit-profile-form button {
  border: none;
  border-radius: 6px;
  padding: 0.5em 1em;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  transition: background 0.2s;
}

#save-profile-btn {
  background: var(--primary-color);
  color: var(--background-dark);
}

#cancel-edit-profile-btn {
  background: var(--danger-color);
  color: var(--text-color);
}

/* Tabs Navigation */
.tabs {
  display: flex;
  gap: 1rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
  position: relative;
}

.tab-indicator {
  position: absolute;
  bottom: -1px;
  height: 2px;
  background-color: var(--primary-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.8rem 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: color 0.2s ease;
}

.tab-btn.active {
  color: var(--primary-color);
}

.tab-btn i {
  margin-right: 0.5em;
}

/* Tab Content */
.tab-content {
  display: none;
  animation: fadeIn 0.5s ease;
}

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

/* Dashboard Tab Content */
.dashboard-overview-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  display: grid;
}

#profile-details-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#profile-details-list li {
  margin-bottom: 1rem;
  font-size: 1rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#profile-details-list b {
  color: var(--text-color);
  font-weight: 600;
}

/* Quick Links Tab Content */
.quick-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.2rem;
}

.quick-link-item {
  background: var(--background-card);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.4rem 1.6rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  display: flex;
  gap: 1.2rem;
  align-items: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.quick-link-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(6, 182, 212, 0.1));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.quick-link-item:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 12px 40px rgba(139, 92, 246, 0.3);
  border-color: rgba(139, 92, 246, 0.5);
}

.quick-link-item:hover::before {
  opacity: 1;
}

.quick-link-item .icon {
  font-size: 1.8rem;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  width: 40px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.quick-link-item b {
  color: var(--text-color);
  font-size: 1.1rem;
  font-weight: 800;
  position: relative;
  z-index: 1;
}

.quick-link-item p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0.3rem 0 0 0;
  line-height: 1.6;
  position: relative;
  z-index: 1;
  font-weight: 400;
}

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

.exam-card {
  background: var(--background-card);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.exam-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(139, 92, 246, 0.2);
}

.exam-card h3 {
  color: var(--text-color);
  margin-top: 0;
  font-size: 1.25rem;
  font-weight: 800;
}

.exam-card p {
  flex-grow: 1;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
  font-weight: 400;
}

.exam-card .exam-btn {
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.8em 1.4em;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  margin-top: 1.2rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.exam-card .exam-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(139, 92, 246, 0.5);
}

.source-tag {
  font-size: 0.8em;
  color: var(--primary-color);
  margin-left: 0.5em;
  background-color: #00ff4122;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Hamburger Menu */
.hamburger {
  display: none;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--primary-color);
  font-size: 2rem;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 10001;
  padding: 0.5rem;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  border-radius: 8px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

.hamburger i {
  font-size: 1.5rem;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 70px;
  right: 1rem;
  background: var(--background-light);
  border-radius: 12px;
  box-shadow: 0 4px 24px #00000055;
  padding: 1rem 1.5rem;
  z-index: 10000;
  border: 1px solid #ffffff33;
  pointer-events: auto;
  min-width: 200px;
}

.mobile-menu a {
  text-decoration: none;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.8rem 0.5rem;
  font-weight: 600;
  pointer-events: auto;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 44px;
}

.mobile-edit {
  color: var(--primary-color);
}

.mobile-logout {
  color: #ff6b81;
}

.mobile-delete {
  color: var(--danger-color);
  margin-top: 0.5rem;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  background: rgba(24, 28, 36, 0.85);
  backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  display: flex;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--background-light);
  border-radius: 16px;
  padding: 2em;
  max-width: 400px;
  width: 90vw;
  text-align: center;
  border: 2px solid;
  transform: scale(0.9);
  opacity: 0;
  transition: all 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
  opacity: 1;
}

#delete-modal .modal-content {
  box-shadow: 0 0 32px #ff475799;
  border-color: var(--danger-color);
}

#result-modal .modal-content {
  box-shadow: 0 0 32px #00ff41cc;
  border-color: var(--primary-color);
}

.modal-content h3 {
  font-size: 1.3em;
  font-weight: bold;
  margin-top: 0;
  margin-bottom: 0.7em;
}

#delete-modal h3 {
  color: var(--danger-color);
}

.modal-content p {
  color: #fff;
  margin-bottom: 1.5em;
}

.modal-content .modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.modal-content button {
  border: none;
  border-radius: 8px;
  padding: 0.6em 1.5em;
  font-weight: 600;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.2s ease;
}

#confirm-delete-btn {
  background: linear-gradient(90deg, #ff4757 60%, #ff6b81 100%);
  color: #fff;
}

#confirm-delete-btn:hover {
  transform: scale(1.05);
}

#cancel-delete-btn {
  background: #2e3440;
  color: #fff;
}

#cancel-delete-btn:hover {
  background: #3b4252;
}

#result-modal-close-btn {
  background: var(--primary-color);
  color: var(--background-dark);
}

#result-modal-close-btn:hover {
  transform: scale(1.05);
}

/* Private Exam Items */
.private-exam-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border-color);
}

.private-exam-item:first-of-type {
  border-top: none;
  padding-top: 0;
}

.exam-info {
  flex: 1;
}

.exam-info h4 {
  font-size: 1.15rem;
  color: var(--text-color);
  margin: 0 0 0.25rem 0;
}

.exam-info p {
  margin: 0;
  font-size: 0.9rem;
  max-width: 60ch;
}

.exam-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1rem;
  font-size: 0.9em;
  color: var(--text-muted);
}

.exam-meta span {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.exam-meta i {
  color: var(--primary-color);
  font-size: 1.1em;
}

.exam-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.exam-card .exam-btn,
.exam-btn.primary {
  background: var(--primary-color);
  color: var(--background-dark);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0.7em 1.2em;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  justify-content: center;
}

.exam-card .exam-btn:hover,
.exam-btn.primary:hover {
  background-color: #2cff68;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 255, 65, 0.3);
}

.exam-btn.secondary {
  background: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  padding: 0.7em 1.2em;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  justify-content: center;
}

.exam-btn.secondary:hover {
  background: var(--primary-color);
  color: var(--background-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 255, 65, 0.2);
}

/* Footer */
.login-footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .dashboard-container {
    padding: 0 1.5rem;
    margin: 1.5rem auto;
  }

  .dashboard-overview-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (max-width: 900px) {
  .dashboard-container {
    padding: 0 1.5rem;
    margin: 1.5rem auto;
  }

  .quick-links-grid,
  .exams-grid {
    grid-template-columns: 1fr;
  }

  .hamburger {
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .dashboard-navbar .logout-btn {
    display: none;
  }

  .profile-actions {
    display: none;
  }

  .mobile-menu.active {
    display: block;
  }

  .mobile-menu {
    right: 1rem;
    top: 70px;
    z-index: 10000;
  }
}

@media (max-width: 768px) {
  .private-exam-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .exam-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .th-card {
    padding: 1.5rem;
  }

  .th-card-header {
    font-size: 1.3rem;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 14px;
  }

  .dashboard-navbar {
    padding: 1rem;
  }

  .dashboard-navbar .brand {
    font-size: 1.2rem;
  }

  .dashboard-container {
    padding: 0 1rem;
    margin: 1rem auto;
  }

  .profile-card {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
    padding: 1.5rem;
  }

  .profile-actions {
    top: 1rem;
    right: 1rem;
  }

  .user-name {
    justify-content: center;
    font-size: 1.4rem;
  }

  .user-avatar {
    width: 60px;
    height: 60px;
  }

  .tabs {
    gap: 0;
  }

  .tab-btn {
    padding: 0.8rem 0.2rem;
    font-size: 0.85rem;
    flex-grow: 1;
    text-align: center;
  }

  .tab-btn i {
    display: block;
    margin: 0 auto 0.3rem auto;
    font-size: 1.2rem;
  }

  .quick-link-item {
    padding: 1.2rem 1rem;
  }

  .quick-link-item b {
    font-size: 1rem;
  }

  .quick-link-item p {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .dashboard-navbar {
    padding: 0.8rem 1rem;
  }

  .dashboard-navbar .brand {
    font-size: 1rem;
  }

  .profile-card {
    padding: 1.2rem;
  }

  .user-name {
    font-size: 1.2rem;
  }

  .user-email {
    font-size: 0.9rem;
  }

  .th-card {
    padding: 1.2rem;
  }

  .th-card-header {
    font-size: 1.1rem;
  }

  .exam-card {
    padding: 1.4rem;
  }

  .exam-card h3 {
    font-size: 1.1rem;
  }
}

/* Accessibility improvements */
.tab-btn:focus-visible,
.quick-link-item:focus-visible,
.exam-btn:focus-visible,
.logout-btn:focus-visible,
.hamburger:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
