/* --- SIDEBAR ANCHOR CONTAINER --- */
.sidebar-anchor-container {
  margin-bottom: 1.5rem;
}

/* --- ARTICLE ANCHOR (Sidebar) --- */
.article-anchor {
  position: relative;
  display: grid;
  grid-template-columns: auto 1px 1fr;
  align-items: start;
  gap: 1.25rem;
  padding: 1.5rem;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-tertiary);
}

.article-anchor__divider {
  width: 1px;
  height: 100%;
  background: var(--border-color);
  opacity: 0.3;
}

.article-anchor__label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent-blue);
  white-space: nowrap;
  line-height: 1.4;
  padding-top: 0.1rem;
}

.article-anchor__body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.article-anchor__title {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  word-wrap: break-word;
  font-family: var(--font-family-heading);
}

.article-anchor__meta {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  word-wrap: break-word;
  font-weight: 500;
}

/* --- ARTICLE CONTENT AREA --- */

.article-content-area {
  background-color: var(--background-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
}

[data-theme='light'] .article-content-area {
  background-color: var(--background-card);
  border: 1px solid var(--border-color);
}

@media (min-width: 768px) {
  .article-content-area {
    padding: 3rem;
  }
}

.article-content-area .loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
}

/* --- ARTICLE TYPOGRAPHY --- */
.article-content-area h1 {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-family: var(--font-family-heading);
}

.article-content-area h2 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-family: var(--font-family-heading);
}

.article-content-area p {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.article-content-area a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

.article-content-area a:hover {
  color: var(--accent-blue-dark);
  text-decoration: underline;
}

.article-content-area img,
.article-content-area video {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 2rem 0;
}

.article-content-area blockquote {
  margin: 2rem 0;
  padding-left: 1.5rem;
  border-left: 4px solid var(--accent-blue);
  font-style: italic;
  color: var(--text-tertiary);
}

.article-content-area ul,
.article-content-area ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

.article-content-area li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

.article-content-area code {
  background-color: var(--background-end);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  font-size: 0.9em;
}

.article-content-area pre {
  background-color: var(--background-end);
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.article-content-area pre code {
  border: none;
  padding: 0;
  background: none;
}

/* --- COMMENTS SECTION --- */
.comments-container {
  margin-top: var(--space-2xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--border-subtle);
}

.comments-container h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--space-xl);
  color: var(--text-primary);
  font-family: var(--font-family-heading);
}

/* Comment Form */
.comment-form {
  margin-bottom: var(--space-2xl);
}

.comment-form #comment-login-prompt {
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.comment-form #comment-login-prompt a {
  color: var(--accent-primary);
  text-decoration: none;
}

.comment-form #comment-login-prompt a:hover {
  text-decoration: underline;
}

.comment-input-wrapper {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  flex-direction: column;
}

.comment-form textarea {
  flex: 1;
  min-height: 80px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-family: inherit;
  resize: vertical;
  width: 100%;
}

.comment-form textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.comment-form textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.comment-form button {
  background: var(--accent-primary);
  color: #ffffff;
  font-weight: 500;
  font-size: var(--font-size-sm);
  padding: var(--space-md) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
}

.comment-form button:hover:not(:disabled) {
  background: var(--accent-hover);
}

.comment-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Comment List */
.comment-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.comment-list:empty::before {
  content: 'No comments yet.';
  display: block;
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
}

.comment-list .comment-item {
  display: flex;
  gap: var(--space-md);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border-subtle);
}

.comment-list .comment-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.comment-item .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.comment-content {
  flex: 1;
  min-width: 0;
}

.comment-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.comment-content .comment-author {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}

.comment-content .comment-date {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

.comment-content .comment-text {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: var(--font-size-sm);
  word-wrap: break-word;
}

/* Responsive Design */
@media (max-width: 640px) {
  .comment-input-wrapper {
    flex-direction: column;
  }
  
  .comment-form button {
    align-self: flex-end;
  }
}

/* --- SIDEBAR SHARE BUTTONS --- */
.share-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.share-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid var(--border-color);
  background: var(--background-card);
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.share-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.1;
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
}

.share-btn:hover::before {
  width: 100%;
  height: 100%;
}

.share-btn:hover {
  transform: translateY(-4px);
  border-color: currentColor;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.share-btn:active {
  transform: translateY(-2px);
}

.share-btn.twitter {
  color: var(--text-secondary);
}

.share-btn.twitter:hover {
  color: #1DA1F2;
  border-color: #1DA1F2;
  background: rgba(29, 161, 242, 0.1);
}

.share-btn.linkedin {
  color: var(--text-secondary);
}

.share-btn.linkedin:hover {
  color: #0A66C2;
  border-color: #0A66C2;
  background: rgba(10, 102, 194, 0.1);
}

.share-btn.facebook {
  color: var(--text-secondary);
}

.share-btn.facebook:hover {
  color: #1877F2;
  border-color: #1877F2;
  background: rgba(24, 119, 242, 0.1);
}

.share-btn.link {
  color: var(--text-secondary);
}

.share-btn.link:hover {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  background: rgba(96, 165, 250, 0.1);
}

.share-btn.copied {
  color: #22c55e;
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
  animation: successPulse 0.6s ease;
}

@keyframes successPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
}

/* --- SHARE TOAST NOTIFICATION --- */
.share-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--background-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  opacity: 0;
  transform: translateY(100px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.share-toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.share-toast i {
  font-size: 1.5rem;
  color: #22c55e;
}

.share-toast.error i {
  color: #ef4444;
}

.share-toast span {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .share-toast {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    justify-content: center;
  }
  
  .share-buttons {
    gap: 0.5rem;
  }
  
  .share-btn {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }
}

/* --- READING PROGRESS BAR --- */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-blue) 0%, var(--accent-blue-dark) 100%);
  z-index: 1001;
  transition: width 0.1s ease-out;
}

/* --- TABLE OF CONTENTS --- */
.table-of-contents {
  background: var(--background-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.toc-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-family-heading);
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-item {
  margin-bottom: 0.5rem;
}

.toc-link {
  display: block;
  padding: 0.5rem 0.75rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.toc-link:hover {
  background: var(--background-end);
  color: var(--text-primary);
  padding-left: 1rem;
}

.toc-link.active {
  background: var(--background-tertiary);
  color: var(--accent-blue);
  border-left: 3px solid var(--accent-blue);
  padding-left: 1rem;
}

/* --- ARTICLE META ROW --- */
.article-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.article-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin: 0;
}

/* --- READING TIME BADGE --- */
.article-reading-time {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.article-reading-time i {
  color: var(--accent-blue);
  font-size: 0.9rem;
}

/* --- SOURCES SECTION --- */
.sources-section {
  background: var(--background-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem 0;
}

.sources-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-family: var(--font-family-heading);
}

.sources-header i {
  color: var(--accent-blue);
}

.sources-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.source-item {
  display: flex;
  align-items: start;
  gap: 1rem;
  padding: 1rem;
  background: var(--background-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.source-item:hover {
  border-color: var(--border-hover);
  transform: translateX(4px);
}

.source-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent-blue);
  color: white;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.source-content {
  flex: 1;
}

.source-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.source-url {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  word-break: break-all;
}

/* --- ENHANCED ARTICLE BODY --- */
.article-body h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-family-heading);
}

.article-body h4 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-family: var(--font-family-heading);
}

.article-body strong {
  color: var(--text-primary);
  font-weight: 600;
}

.article-body em {
  font-style: italic;
  color: var(--text-secondary);
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  .sources-section {
    padding: 1.5rem;
  }
  
  .table-of-contents {
    padding: 1rem;
  }
}

/* ==========================================
   MODERN PROFILE PAGE DESIGN
   ========================================== */

/* Profile page body styles */
body.profile-page {
  padding-top: 100px;
  background: var(--bg-secondary);
  min-height: 100vh;
}

/* ==========================================
   PROFILE CONTAINER
   ========================================== */

.profile-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-32) var(--space-24);
}

/* ==========================================
   PROFILE HEADER SECTION
   ========================================== */

.profile-header {
  margin-bottom: var(--space-32);
}

.profile-banner {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-40);
  display: flex;
  align-items: center;
  gap: var(--space-32);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

.profile-banner:hover {
  box-shadow: var(--shadow-md);
}

/* Avatar Section */
.profile-avatar-section {
  flex-shrink: 0;
}

.avatar-upload-label {
  position: relative;
  display: block;
  cursor: pointer;
  width: 120px;
  height: 120px;
}

.profile-avatar-img {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 4px solid var(--border-subtle);
  transition: all var(--transition-base);
  display: block;
}

.avatar-upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-base);
  color: #ffffff;
  font-size: 24px;
}

.avatar-upload-label:hover .avatar-upload-overlay {
  opacity: 1;
}

.avatar-upload-label:hover .profile-avatar-img {
  border-color: var(--logo-color);
  transform: scale(1.02);
}

/* Profile Info Section */
.profile-info-section {
  flex: 1;
  min-width: 0;
}

.profile-display-name {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-8);
  line-height: 1.2;
  font-family: var(--font-family-heading);
}

.profile-username-text {
  font-size: var(--font-size-base);
  color: var(--logo-color);
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.profile-email-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-16);
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  background: var(--bg-secondary);
  padding: var(--space-8) var(--space-16);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.profile-badge i {
  color: var(--logo-color);
}

/* ==========================================
   SETTINGS SECTION
   ========================================== */

.settings-section {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-40);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

.settings-section:hover {
  box-shadow: var(--shadow-md);
}

.section-header {
  margin-bottom: var(--space-32);
  padding-bottom: var(--space-24);
  border-bottom: 1px solid var(--border-subtle);
}

.section-header h2 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-8);
  line-height: 1.2;
  font-family: var(--font-family-heading);
}

.section-header p {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* ==========================================
   FORM STYLING
   ========================================== */

.settings-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-24);
}

/* Form Row (for side-by-side fields) */
.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-24);
}

/* Form Field */
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.field-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}

/* Input Group */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  pointer-events: none;
  transition: color var(--transition-fast);
  z-index: 1;
}

.input-group:focus-within .input-icon {
  color: var(--logo-color);
}

/* Form Control */
.form-control {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  font-family: inherit;
  line-height: 1.5;
  transition: all var(--transition-base);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-control:hover {
  border-color: var(--border-color);
  background: var(--bg-primary);
}

.form-control:focus {
  outline: none;
  border-color: var(--logo-color);
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
  padding-top: 12px;
}

/* Field Feedback */
.field-feedback {
  font-size: var(--font-size-xs);
  font-weight: 500;
  margin-top: var(--space-4);
}

/* ==========================================
   FORM FOOTER
   ========================================== */

.form-footer {
  margin-top: var(--space-16);
  padding-top: var(--space-24);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-20);
}

.status-message {
  flex: 1;
  font-size: var(--font-size-sm);
  font-weight: 600;
  padding: var(--space-12) var(--space-16);
  border-radius: var(--radius-md);
}

.status-message:empty {
  display: none;
}

.status-message.success {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-message.error {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: var(--space-12);
}

/* ==========================================
   BUTTONS
   ========================================== */

.btn {
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-base);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  white-space: nowrap;
  line-height: 1;
}

.btn i {
  font-size: var(--font-size-sm);
}

.btn-primary {
  background: var(--logo-color);
  color: #ffffff;
  border-color: var(--logo-color);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: #2563eb;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-outline:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-outline:active {
  background: var(--bg-hover);
}

/* ==========================================
   HEADER ACTIVE STATE
   ========================================== */

.header-actions .user-link.active {
  background: var(--bg-hover);
  color: var(--logo-color);
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 1024px) {
  body.profile-page {
    padding-top: 220px;
  }

  .profile-container {
    padding: var(--space-24) var(--space-16);
  }
}

@media (max-width: 768px) {
  body.profile-page {
    padding-top: 240px;
  }

  .profile-container {
    padding: var(--space-20) var(--space-12);
  }

  .profile-banner {
    flex-direction: column;
    text-align: center;
    padding: var(--space-32);
    gap: var(--space-24);
  }

  .profile-info-section {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .settings-section {
    padding: var(--space-32) var(--space-24);
  }

  .section-header {
    margin-bottom: var(--space-24);
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: var(--space-20);
  }

  .form-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .action-buttons {
    width: 100%;
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .status-message {
    text-align: center;
  }
}

@media (max-width: 640px) {
  .profile-display-name {
    font-size: 1.5rem;
  }

  .avatar-upload-label,
  .profile-avatar-img {
    width: 100px;
    height: 100px;
  }

  .settings-section {
    padding: var(--space-24) var(--space-20);
  }

  .section-header h2 {
    font-size: var(--font-size-xl);
  }
}

/* ==========================================
   UTILITY & ANIMATIONS
   ========================================== */

.btn:focus-visible,
.form-control:focus-visible {
  outline: 2px solid var(--logo-color);
  outline-offset: 2px;
}

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

.profile-banner,
.settings-section {
  animation: fadeIn 0.4s ease-out;
}

.settings-section {
  animation-delay: 0.1s;
}
/* Page-specific styles use CSS variables from main.css for consistent theming */

/* Base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* Login/Signup page specific body styles */
body.login-page {
  font-family: var(--font-family);
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Login Page Header Overrides */
body.login-page .header {
  position: relative;
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: none;
}

body.login-page .header-content {
  padding: 1.25rem 2rem;
  justify-content: center;
  position: relative;
}

body.login-page .header-left {
  position: absolute;
  left: 2rem;
}

body.login-page .search-container {
  display: none;
}

body.login-page .user-links {
  display: none;
}

body.login-page .theme-toggle-btn {
  position: absolute;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
}

body.login-page .logo {
  font-size: 1.25rem;
}

body.login-page .logo-text {
  font-size: 1.375rem;
}

@media (max-width: 768px) {
  body.login-page .header-content {
    padding: 1rem 1.5rem;
  }
  
  body.login-page .header-left {
    left: 1.5rem;
  }
  
  body.login-page .theme-toggle-btn {
    right: 1.5rem;
  }
  
  body.login-page .logo-text {
    font-size: 1.125rem;
  }
}

@media (max-width: 480px) {
  body.login-page .header-content {
    padding: 0.875rem 1rem;
  }
  
  body.login-page .header-left {
    left: 1rem;
  }
  
  body.login-page .theme-toggle-btn {
    right: 1rem;
  }
  
  body.login-page .logo-avatar {
    width: 24px;
    height: 24px;
  }
  
  body.login-page .logo-text {
    font-size: 1rem;
  }
}

/* Standalone Theme Toggle Button (for pages without header) */
.standalone-theme-toggle {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 1.25rem;
  width: 44px;
  height: 44px;
  z-index: 10;
}
.standalone-theme-toggle:hover {
  background: var(--bg-subtle);
  color: var(--accent-primary);
}

/* Main wrapper for centering content */
.main-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 2rem 1rem;
  flex: 1;
}

/* Login Card */
.login-card {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.login-card h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 0.5rem;
  font-family: var(--font-family-heading);
}

/* Form styles */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
}

input {
  width: 100%;
  padding: 0.85rem 1.25rem;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: 1rem;
  outline: none;
  transition: all 0.2s ease;
}

input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

button[type='submit'],
#google-signin-btn {
  width: 100%;
  padding: 0.85rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

button[type='submit'] {
  background: var(--accent-primary);
  color: white;
}

button[type='submit']:hover {
  background: var(--accent-hover);
}

#google-signin-btn {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

#google-signin-btn:hover {
  background: var(--border-color);
}

#google-signin-btn i {
  font-size: 1.1rem;
}

/* Divider style */
.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0.5rem 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.divider:not(:empty)::before {
  margin-right: 0.75em;
}

.divider:not(:empty)::after {
  margin-left: 0.75em;
}

/* Message div */
#message {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .main-wrapper {
    padding: 1.5rem 1rem;
  }
  
  .login-card {
    padding: 1.75rem;
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .main-wrapper {
    padding: 1rem 0.75rem;
  }
  
  .login-card {
    padding: 1.5rem;
    gap: 1rem;
  }
  
  .login-card h2 {
    font-size: 1.5rem;
  }
  
  button[type='submit'],
  #google-signin-btn {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
  }
  
  .standalone-theme-toggle {
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}
