/* TIUGURU - Phase 1 Styling */
/* Main CSS with Light and Dark Theme Support */

:root {
  /* Light Theme (Default) - Peach & White with improved contrast */
  --primary-color: #e85b2b;
  --secondary-color: #e6841a;
  --accent-color: #f49500;
  --background-primary: #fdfbf7;
  --background-secondary: #ffffff;
  --background-tertiary: #fff9f2;
  --text-primary: #1a252f;
  --text-secondary: #495057;
  --text-muted: #6c757d;
  --text-color: #1a252f;
  --success-color: #22c55e;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --border-color: rgba(232, 91, 43, 0.15);
  --shadow-light: rgba(232, 91, 43, 0.1);
  --shadow-medium: rgba(232, 91, 43, 0.2);
  --gradient-primary: linear-gradient(135deg, #e85b2b, #e6841a);
  --gradient-secondary: linear-gradient(135deg, #f49500, #e85b2b);
  --gradient-soft: linear-gradient(135deg, rgba(232, 91, 43, 0.08), rgba(230, 132, 26, 0.08));
  
  /* Theme Toggle Button Styling for Light Mode */
  --theme-btn-bg: rgba(232, 91, 43, 0.1);
  --theme-btn-hover: rgba(232, 91, 43, 0.15);
  --theme-btn-border: rgba(232, 91, 43, 0.2);
}

[data-theme="dark"],
html[data-theme="dark"],
body[data-theme="dark"] {
  /* Dark Theme - Black & Orange with improved contrast */
  --primary-color: #ff7a4a;
  --secondary-color: #ffa533;
  --accent-color: #ffb84d;
  --background-primary: #0d1117;
  --background-secondary: #161b22;
  --background-tertiary: #21262d;
  --text-primary: #f0f6fc;
  --text-secondary: #e6edf3;
  --text-muted: #7d8590;
  --text-color: #f0f6fc;
  --success-color: #4ade80;
  --warning-color: #fbbf24;
  --danger-color: #f87171;
  --border-color: rgba(255, 122, 74, 0.3);
  --shadow-light: rgba(255, 122, 74, 0.2);
  --shadow-medium: rgba(255, 122, 74, 0.3);
  --gradient-primary: linear-gradient(135deg, #ff7a4a, #ffa533);
  --gradient-secondary: linear-gradient(135deg, #ffa533, #ffb84d);
  --gradient-soft: linear-gradient(135deg, rgba(255, 122, 74, 0.15), rgba(255, 165, 51, 0.15));
  
  /* Theme Toggle Button Styling for Dark Mode */
  --theme-btn-bg: rgba(255, 122, 74, 0.1);
  --theme-btn-hover: rgba(255, 122, 74, 0.2);
  --theme-btn-border: rgba(255, 122, 74, 0.3);
}

/* Dropdown Theme Toggle Centering */
.dropdown-item-centered {
  padding: 0.5rem 1rem;
  text-align: center;
}

.dropdown-item-centered .theme-toggle {
  border: 1px solid var(--theme-btn-border);
  background: var(--theme-btn-bg);
  color: var(--text-primary);
  transition: all 0.3s ease;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  min-width: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.dropdown-item-centered .theme-toggle:hover {
  background: var(--theme-btn-hover);
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: scale(1.05);
}

.dropdown-item-centered .theme-toggle:focus {
  box-shadow: 0 0 0 0.2rem rgba(232, 91, 43, 0.25);
  outline: none;
}

[data-theme="dark"] .dropdown-item-centered .theme-toggle:focus {
  box-shadow: 0 0 0 0.2rem rgba(255, 122, 74, 0.25);
}

/* Base Styles */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--background-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: all 0.3s ease;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

/* Main Content Container - Fix flexbox layout */
.main-content {
  position: relative;
  z-index: 1;
  padding-top: 80px;
  padding-bottom: 0;
}

/* Authenticated user styling - match dashboard */
.main-content.authenticated {
  background: var(--background-primary);
  padding-top: 100px;
}

.main-content.authenticated .container-xxl {
  max-width: 1400px;
}

/* Dashboard-style background for authenticated pages */
body:has(.main-content.authenticated) {
  background: var(--background-primary);
}

/* Bootstrap Overrides */
.container {
  position: relative;
  z-index: 2;
}

/* Mobile First Responsive Design */
@media (max-width: 576px) {
  .main-content {
    padding-top: 100px;
  }
  
  .container {
    padding-left: 15px;
    padding-right: 15px;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  h3 {
    font-size: 1.3rem;
  }
  
  .btn {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
  }
}

@media (max-width: 768px) {
  .main-content {
    padding-top: 90px;
  }
  
  .row {
    margin-left: -10px;
    margin-right: -10px;
  }
  
  .col,
  [class*="col-"] {
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* Navigation Styles */
.navbar {
  backdrop-filter: blur(15px);
  background: rgba(0, 0, 0, 0.9) !important;
  border-bottom: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

[data-theme="dark"] .navbar {
  background: rgba(10, 10, 10, 0.95) !important;
  border-bottom: 1px solid var(--primary-color);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--primary-color) !important;
  text-decoration: none;
  transition: all 0.3s ease;
}

.navbar-brand:hover {
  transform: scale(1.05);
  text-shadow: 0 0 10px var(--primary-color);
}

.nav-link {
  color: #ffffff !important;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  padding: 0.5rem 1rem !important;
  border-radius: 8px;
}

.nav-link:hover {
  color: var(--primary-color) !important;
  background: rgba(255, 107, 53, 0.1);
  transform: translateY(-2px);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav-link:hover::after {
  width: 80%;
}

/* Dropdown Styles */
.dropdown-menu {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 30px var(--shadow-medium);
  backdrop-filter: blur(10px);
  animation: slideDown 0.3s ease;
}

.dropdown-item {
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  margin: 0.25rem;
  transition: all 0.3s ease;
}

.dropdown-item:hover {
  background: var(--gradient-soft);
  color: var(--primary-color);
  transform: translateX(5px);
}

/* Card Styles */
.card {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 4px 20px var(--shadow-light);
  transition: all 0.3s ease;
  overflow: hidden;
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 40px var(--shadow-medium);
}

.card:hover::before {
  opacity: 1;
}

.card-header {
  background: var(--gradient-soft);
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: 1.5rem;
}

/* Button Styles */
.btn {
  border-radius: 10px;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  transition: all 0.3s ease;
  border: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: var(--gradient-primary);
  border: none;
  color: white;
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(255, 107, 53, 0.4);
  background: var(--gradient-secondary);
}

.btn-outline-primary {
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  background: transparent;
}

.btn-outline-primary:hover {
  background: var(--gradient-primary);
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
}

.btn-secondary {
  background: var(--background-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--gradient-soft);
  color: var(--primary-color);
  transform: translateY(-2px);
}

/* Form Styles */
.form-control,
.form-select {
  background: var(--background-secondary);
  border: 2px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(255, 107, 53, 0.25);
  background: var(--background-secondary);
  color: var(--text-primary);
}

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

.form-label {
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.form-text {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Badge Styles */
.badge {
  border-radius: 8px;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge.bg-primary {
  background: var(--gradient-primary) !important;
}

.badge.bg-secondary {
  background: var(--background-tertiary) !important;
  color: var(--text-primary) !important;
}

.badge.bg-success {
  background: linear-gradient(135deg, #28a745, #20c997) !important;
}

.badge.bg-warning {
  background: linear-gradient(135deg, #ffc107, #fd7e14) !important;
  color: #000 !important;
}

.badge.bg-danger {
  background: linear-gradient(135deg, #dc3545, #e74c3c) !important;
}

.badge.bg-info {
  background: linear-gradient(135deg, #17a2b8, #6f42c1) !important;
}

/* Alert Styles */
.alert {
  border: none;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.alert::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-color);
}

.alert-success {
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.1), rgba(32, 201, 151, 0.1));
  color: #155724;
  border-left: 4px solid #28a745;
}

.alert-warning {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(253, 126, 20, 0.1));
  color: #856404;
  border-left: 4px solid #ffc107;
}

.alert-danger {
  background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(231, 76, 60, 0.1));
  color: #721c24;
  border-left: 4px solid #dc3545;
}

.alert-info {
  background: linear-gradient(135deg, rgba(23, 162, 184, 0.1), rgba(111, 66, 193, 0.1));
  color: #0c5460;
  border-left: 4px solid #17a2b8;
}

[data-theme="dark"] .alert-success {
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.2), rgba(32, 201, 151, 0.2));
  color: #4dff4d;
}

[data-theme="dark"] .alert-warning {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.2), rgba(253, 126, 20, 0.2));
  color: #ffff4d;
}

[data-theme="dark"] .alert-danger {
  background: linear-gradient(135deg, rgba(220, 53, 69, 0.2), rgba(231, 76, 60, 0.2));
  color: #ff4d4d;
}

[data-theme="dark"] .alert-info {
  background: linear-gradient(135deg, rgba(23, 162, 184, 0.2), rgba(111, 66, 193, 0.2));
  color: #4dc3ff;
}

/* Table Styles */
.table {
  background: var(--background-secondary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px var(--shadow-light);
}

.table th {
  background: var(--gradient-soft);
  color: var(--text-primary);
  font-weight: 600;
  border: none;
  padding: 1rem;
}

.table td {
  color: var(--text-primary);
  border-color: var(--border-color);
  padding: 1rem;
  vertical-align: middle;
}

.table-hover tbody tr:hover {
  background: var(--gradient-soft);
  transform: scale(1.01);
  transition: all 0.3s ease;
}

/* Progress Bar Styles */
.progress {
  height: 10px;
  border-radius: 10px;
  background: var(--background-tertiary);
  overflow: hidden;
}

.progress-bar {
  background: var(--gradient-primary);
  border-radius: 10px;
  transition: width 0.6s ease;
}

/* Dark theme progress bars */
[data-theme="dark"] .progress {
  background-color: var(--card-bg-dark);
}

[data-theme="dark"] .progress-bar-container {
  background: #4a5568;
}

/* Dark theme badges and cards */
[data-theme="dark"] .badge {
  color: #e2e8f0;
}

[data-theme="dark"] .gpa-excellent { background: #2d5a3d !important; color: #68d391 !important; }
[data-theme="dark"] .gpa-good { background: #2c5f6f !important; color: #63b3ed !important; }
[data-theme="dark"] .gpa-average { background: #5a4a2f !important; color: #f6e05e !important; }
[data-theme="dark"] .gpa-below { background: #5a2c2c !important; color: #fc8181 !important; }

[data-theme="dark"] .status-active { background: #2d5a3d !important; color: #68d391 !important; }
[data-theme="dark"] .status-inactive { background: #5a2c2c !important; color: #fc8181 !important; }
[data-theme="dark"] .status-graduated { background: #2c5f6f !important; color: #63b3ed !important; }

/* Dark theme container and card fixes */
[data-theme="dark"] .card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .table {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
    border-color: #4a5568 !important;
}

[data-theme="dark"] .table th,
[data-theme="dark"] .table td {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
    border-color: #4a5568 !important;
}

[data-theme="dark"] .table-hover tbody tr:hover {
    background: #3d4852 !important;
}

/* Dark theme text visibility fixes */
[data-theme="dark"] h1, 
[data-theme="dark"] h2, 
[data-theme="dark"] h3, 
[data-theme="dark"] h4, 
[data-theme="dark"] h5, 
[data-theme="dark"] h6,
[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] div {
    color: #e2e8f0 !important;
}

/* Modal Styles */
.modal-content {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 20px 60px var(--shadow-medium);
  backdrop-filter: blur(10px);
}

.modal-header {
  background: var(--gradient-soft);
  border-bottom: 1px solid var(--border-color);
  border-radius: 16px 16px 0 0;
}

.modal-title {
  color: var(--text-primary);
  font-weight: 600;
}

.modal-body {
  color: var(--text-primary);
}

.modal-footer {
  border-top: 1px solid var(--border-color);
  background: var(--background-tertiary);
  border-radius: 0 0 16px 16px;
}

/* Breadcrumb Styles */
.breadcrumb {
  background: transparent;
  padding: 0;
  margin-bottom: 1rem;
}

.breadcrumb-item {
  color: var(--text-muted);
}

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 600;
}

.breadcrumb-item a {
  color: var(--primary-color);
  text-decoration: none;
  transition: all 0.3s ease;
}

.breadcrumb-item a:hover {
  color: var(--secondary-color);
  text-shadow: 0 0 5px var(--primary-color);
}

/* List Group Styles */
.list-group {
  border-radius: 12px;
  overflow: hidden;
}

.list-group-item {
  background: var(--background-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.list-group-item:hover {
  background: var(--gradient-soft);
  transform: translateX(5px);
  border-color: var(--primary-color);
}

/* Footer Styles - Compact Design */
.footer {
  background: var(--background-secondary);
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 1.5rem 0 1rem;
  margin-top: auto;
}

/* Dark theme footer spacing - 3mm gap above footer */
[data-theme="dark"] .footer,
[data-bs-theme="dark"] .footer,
.dark-theme .footer {
  margin-top: calc(auto + 3mm);
}

[data-theme="dark"] .universal-footer,
[data-bs-theme="dark"] .universal-footer,
.dark-theme .universal-footer {
  margin-top: 3mm;
}

/* Universal Footer - Very compact design, properly fixed */
.universal-footer {
  background: var(--background-secondary);
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.75rem 0 0;
  font-size: 0.85rem;
  width: 100%;
}

/* Very compact footer sections */
.footer-section {
  margin-bottom: 0.5rem;
}

.footer-section h6 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}

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

.footer-links li {
  margin-bottom: 0.15rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.3s ease;
  display: block;
  padding: 0.1rem 0;
}

.footer-links a:hover {
  color: var(--primary-color);
}

/* Very compact brand section */
.footer-brand .brand-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.4rem;
}

.footer-brand .brand-icon {
  font-size: 1.2rem;
  color: var(--primary-color);
  margin-right: 0.5rem;
}

.footer-brand .brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.footer-brand .brand-description {
  font-size: 0.75rem;
  line-height: 1.4;
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
}

/* Contact information */
.contact-quick p {
  font-size: 0.75rem;
  margin-bottom: 0.2rem;
  color: var(--text-secondary);
}

.contact-quick i {
  width: 16px;
  text-align: center;
  color: var(--primary-color);
}

/* Social links - very compact */
.social-links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.4rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--background-tertiary);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8rem;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.social-link:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow-light);
}

/* Footer bottom - very compact, no bottom padding */
.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 0.4rem;
  padding-bottom: 0;
  margin-top: 0.4rem;
  margin-bottom: 0;
}

.footer-bottom p {
  margin: 0;
  padding-bottom: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.footer-bottom .copyright {
  font-weight: 500;
}

.footer-bottom .phase-info {
  font-style: italic;
}

/* Large screen optimizations for footer */
@media (min-width: 1200px) {
  .universal-footer {
    padding: 0.6rem 0 0;
  }
  
  .footer-section {
    margin-bottom: 0.4rem;
  }
  
  .footer-section h6 {
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
  }
  
  .footer-links a {
    font-size: 0.75rem;
    padding: 0.05rem 0;
  }
  
  .footer-brand .brand-description {
    font-size: 0.7rem;
    margin-bottom: 0.3rem;
  }
  
  .contact-quick p {
    font-size: 0.7rem;
    margin-bottom: 0.15rem;
  }
  
  .footer-bottom {
    padding-top: 0.3rem;
    padding-bottom: 0;
    margin-top: 0.3rem;
    margin-bottom: 0;
  }
  
  .footer-bottom p {
    font-size: 0.65rem;
    padding-bottom: 0.4rem;
  }
}

/* Extra large screen optimizations */
@media (min-width: 1400px) {
  .universal-footer {
    padding: 0.5rem 0 0;
  }
  
  .footer-section {
    margin-bottom: 0.3rem;
  }
}

[data-theme="dark"] .footer {
  background: var(--background-secondary);
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
}

[data-theme="dark"] .footer .text-muted {
  color: var(--text-secondary) !important;
}

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

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

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes glow {
  0% {
    box-shadow: 0 0 5px var(--primary-color);
  }
  50% {
    box-shadow: 0 0 20px var(--primary-color);
  }
  100% {
    box-shadow: 0 0 5px var(--primary-color);
  }
}

/* Utility Classes */
.fade-in {
  animation: fadeIn 0.6s ease;
}

.pulse {
  animation: pulse 2s infinite;
}

.glow {
  animation: glow 2s infinite;
}

.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

.bg-gradient {
  background: var(--gradient-primary);
}

.bg-gradient-soft {
  background: var(--gradient-soft);
}

.border-gradient {
  border: 2px solid transparent;
  background: linear-gradient(var(--background-secondary), var(--background-secondary)) padding-box,
              var(--gradient-primary) border-box;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--background-tertiary);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--gradient-primary);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gradient-secondary);
}

/* Selection Styles */
::selection {
  background: var(--primary-color);
  color: white;
}

::-moz-selection {
  background: var(--primary-color);
  color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
  .main-content {
    padding-top: 60px;
  }
  
  .card {
    margin-bottom: 1rem;
  }
  
  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  .navbar-brand {
    font-size: 1.25rem;
  }
  
  .display-6 {
    font-size: 1.75rem;
  }
  
  .lead {
    font-size: 1rem;
  }
}

@media (max-width: 576px) {
  .main-content {
    padding-top: 50px;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
  
  .display-6 {
    font-size: 1.5rem;
  }
}

/* Print Styles */
@media print {
  #particles-js,
  .navbar,
  .footer,
  .btn,
  .modal {
    display: none !important;
  }
  
  .main-content {
    padding-top: 0;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #000;
  }
  
  body {
    background: white;
    color: black;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000;
    --shadow-light: rgba(0, 0, 0, 0.5);
    --shadow-medium: rgba(0, 0, 0, 0.7);
  }
  
  .card {
    border: 2px solid #000;
  }
  
  .btn {
    border: 2px solid #000;
  }
}

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

/* Enhanced Text Visibility for All Themes */
.text-high-contrast,
.card-title,
.card-text,
.nav-link,
.navbar-nav .nav-link,
.dropdown-menu .dropdown-item,
h1, h2, h3, h4, h5, h6,
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6,
.form-label,
.form-control,
.btn,
.alert,
.list-group-item,
.table,
.modal-body,
.modal-header,
.modal-footer,
.breadcrumb,
.pagination,
.badge {
  color: var(--text-primary) !important;
}

/* Secondary text elements */
.text-muted,
.form-text,
.small,
.text-secondary {
  color: var(--text-secondary) !important;
}

/* Ensure form inputs are visible */
.form-control,
.form-select,
.form-check-input {
  background-color: var(--background-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.form-control:focus,
.form-select:focus {
  background-color: var(--background-secondary) !important;
  border-color: var(--primary-color) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 0 0 0.25rem rgba(232, 91, 43, 0.25) !important;
}

/* Dark theme specific visibility fixes */
[data-theme="dark"] .text-dark {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .text-light {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .bg-light {
  background-color: var(--background-secondary) !important;
}

[data-theme="dark"] .bg-white {
  background-color: var(--background-secondary) !important;
}

[data-theme="dark"] .border {
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .dropdown-menu {
  background-color: var(--background-secondary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .dropdown-item {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .dropdown-item:hover {
  background-color: var(--background-tertiary) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .modal-content {
  background-color: var(--background-secondary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .table {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .table td,
[data-theme="dark"] .table th {
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .alert {
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .alert-success {
  background-color: rgba(40, 167, 69, 0.15) !important;
  border-color: rgba(40, 167, 69, 0.3) !important;
  color: #00ff7f !important;
}

[data-theme="dark"] .alert-danger {
  background-color: rgba(220, 53, 69, 0.15) !important;
  border-color: rgba(220, 53, 69, 0.3) !important;
  color: #ff6b6b !important;
}

[data-theme="dark"] .alert-warning {
  background-color: rgba(255, 193, 7, 0.15) !important;
  border-color: rgba(255, 193, 7, 0.3) !important;
  color: #ffd700 !important;
}

[data-theme="dark"] .alert-info {
  background-color: rgba(13, 202, 240, 0.15) !important;
  border-color: rgba(13, 202, 240, 0.3) !important;
  color: #87ceeb !important;
}

/* Light theme specific visibility fixes */
[data-theme="light"] .text-white {
  color: var(--text-primary) !important;
}

/* Footer text visibility fix */
.footer,
.footer p,
.footer a,
.footer .text-muted {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .footer,
[data-theme="dark"] .footer p,
[data-theme="dark"] .footer a,
[data-theme="dark"] .footer .text-muted {
  color: var(--text-secondary) !important;
}

/* Focus Styles for Accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus,
.nav-link:focus {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

/* Loading States */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Global Particles Background */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.3;
}

[data-theme="dark"] #particles-js {
    opacity: 0.5;
}

/* Theme Toggle Button Styles */
.theme-toggle {
    background: none !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.theme-toggle:hover {
    background: var(--background-tertiary) !important;
    border-color: var(--primary-color) !important;
    transform: translateY(-2px);
}

.theme-toggle:focus {
    box-shadow: 0 0 0 0.2rem rgba(231, 91, 43, 0.25);
    outline: none;
}

/* Main content positioning to accommodate particles */
.main-content {
    position: relative;
    z-index: 1;
}

/* ==================== HIGH RESOLUTION RESPONSIVE STYLES ==================== */

/* Extra Large Screens (1400px and up) */
@media (min-width: 1400px) {
    .container,
    .container-lg,
    .container-md,
    .container-sm,
    .container-xl,
    .container-xxl {
        max-width: 1320px;
    }
    
    /* Dashboard Grid Enhancements */
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
    
    /* Card Sizes */
    .card {
        max-width: none;
    }
    
    /* Font Scaling */
    .display-1 { font-size: 5rem; }
    .display-2 { font-size: 4.5rem; }
    .display-3 { font-size: 4rem; }
    .display-4 { font-size: 3.5rem; }
    
    /* Navigation */
    .navbar {
        padding: 1rem 2rem;
    }
    
    .navbar-brand {
        font-size: 1.8rem;
    }
    
    /* Form Layouts */
    .form-row {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .form-row.single {
        grid-template-columns: 1fr;
    }
    
    /* Table Responsiveness */
    .table-responsive {
        font-size: 1rem;
    }
    
    /* Button Scaling */
    .btn-lg {
        padding: 1rem 2rem;
        font-size: 1.25rem;
    }
    
    /* Modal Enhancements */
    .modal-xl {
        max-width: 1200px;
    }
    
    /* Sidebar Layouts */
    .sidebar-content {
        max-width: 350px;
    }
    
    /* Charts and Analytics */
    .chart-container {
        height: 450px;
    }
    
    /* Forum Layout */
    .forum-container {
        display: grid;
        grid-template-columns: 1fr 350px;
        gap: 3rem;
    }
    
    /* Assignment Grid */
    .assignment-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

/* Ultra Wide Screens (1600px and up) */
@media (min-width: 1600px) {
    .container,
    .container-lg,
    .container-md,
    .container-sm,
    .container-xl,
    .container-xxl {
        max-width: 1520px;
    }
    
    /* Dashboard Enhancements */
    .dashboard-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 2.5rem;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(5, 1fr);
        gap: 2.5rem;
    }
    
    /* Typography Scaling */
    .display-1 { font-size: 5.5rem; }
    .display-2 { font-size: 5rem; }
    .display-3 { font-size: 4.5rem; }
    .display-4 { font-size: 4rem; }
    
    h1 { font-size: 3rem; }
    h2 { font-size: 2.5rem; }
    h3 { font-size: 2rem; }
    
    /* Navigation */
    .navbar {
        padding: 1.5rem 3rem;
    }
    
    .navbar-brand {
        font-size: 2rem;
    }
    
    .nav-link {
        font-size: 1.1rem;
        padding: 0.75rem 1.5rem !important;
    }
    
    /* Form Layouts */
    .form-row {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    
    .form-row.two-col {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Cards */
    .card {
        padding: 2rem;
    }
    
    .card-body {
        padding: 2rem;
    }
    
    /* Tables */
    .table td,
    .table th {
        padding: 1rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .btn-lg {
        padding: 1.25rem 2.5rem;
        font-size: 1.5rem;
    }
    
    /* Modals */
    .modal-xl {
        max-width: 1400px;
    }
    
    /* Sidebar */
    .sidebar-content {
        max-width: 400px;
    }
    
    /* Charts */
    .chart-container {
        height: 500px;
    }
    
    /* Forum Layout */
    .forum-container {
        grid-template-columns: 1fr 400px;
        gap: 4rem;
    }
    
    /* Assignment Grid */
    .assignment-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2.5rem;
    }
    
    /* Analytics Dashboard */
    .analytics-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

/* 4K and Ultra High Resolution (2000px and up) */
@media (min-width: 2000px) {
    .container,
    .container-lg,
    .container-md,
    .container-sm,
    .container-xl,
    .container-xxl {
        max-width: 1800px;
    }
    
    /* Dashboard Grid */
    .dashboard-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 3rem;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(6, 1fr);
        gap: 3rem;
    }
    
    /* Typography for 4K */
    .display-1 { font-size: 6rem; }
    .display-2 { font-size: 5.5rem; }
    .display-3 { font-size: 5rem; }
    .display-4 { font-size: 4.5rem; }
    
    h1 { font-size: 3.5rem; }
    h2 { font-size: 3rem; }
    h3 { font-size: 2.5rem; }
    h4 { font-size: 2rem; }
    
    body {
        font-size: 1.125rem;
        line-height: 1.7;
    }
    
    /* Navigation */
    .navbar {
        padding: 2rem 4rem;
    }
    
    .navbar-brand {
        font-size: 2.5rem;
    }
    
    .nav-link {
        font-size: 1.25rem;
        padding: 1rem 2rem !important;
    }
    
    /* Forms */
    .form-row {
        grid-template-columns: repeat(4, 1fr);
        gap: 2.5rem;
    }
    
    .form-control {
        padding: 1rem 1.5rem;
        font-size: 1.125rem;
    }
    
    .form-label {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }
    
    /* Cards */
    .card {
        padding: 3rem;
        border-radius: 20px;
    }
    
    .card-body {
        padding: 3rem;
    }
    
    /* Tables */
    .table td,
    .table th {
        padding: 1.5rem;
        font-size: 1.125rem;
    }
    
    /* Buttons */
    .btn {
        padding: 1rem 2rem;
        font-size: 1.125rem;
        border-radius: 12px;
    }
    
    .btn-lg {
        padding: 1.5rem 3rem;
        font-size: 1.75rem;
    }
    
    /* Modals */
    .modal-xl {
        max-width: 1600px;
    }
    
    .modal-content {
        border-radius: 20px;
    }
    
    /* Sidebar */
    .sidebar-content {
        max-width: 450px;
    }
    
    /* Charts */
    .chart-container {
        height: 600px;
    }
    
    /* Forum Layout */
    .forum-container {
        grid-template-columns: 1fr 450px;
        gap: 5rem;
    }
    
    /* Assignment Grid */
    .assignment-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 3rem;
    }
    
    /* Analytics Dashboard */
    .analytics-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2.5rem;
    }
    
    /* Spacing Adjustments */
    .py-5 {
        padding-top: 4rem !important;
        padding-bottom: 4rem !important;
    }
    
    .my-5 {
        margin-top: 4rem !important;
        margin-bottom: 4rem !important;
    }
    
    .p-4 {
        padding: 2.5rem !important;
    }
    
    .p-5 {
        padding: 3.5rem !important;
    }
}

/* Wide Aspect Ratio Adjustments */
@media (min-aspect-ratio: 16/9) and (min-width: 1400px) {
    .dashboard-container {
        display: grid;
        grid-template-columns: 1fr 350px;
        gap: 3rem;
    }
    
    .main-dashboard {
        min-height: 80vh;
    }
    
    .sidebar-dashboard {
        position: sticky;
        top: 100px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }
}

/* Ultra Wide Aspect Ratio (21:9 and wider) */
@media (min-aspect-ratio: 21/9) and (min-width: 1600px) {
    .dashboard-container {
        grid-template-columns: 1fr 400px;
        gap: 4rem;
    }
    
    .forum-layout {
        display: grid;
        grid-template-columns: 300px 1fr 350px;
        gap: 2rem;
    }
    
    .content-with-sidebar {
        display: grid;
        grid-template-columns: 1fr 350px 350px;
        gap: 2rem;
    }
}

/* High DPI Display Adjustments */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .card {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }
    
    .btn {
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
    
    .navbar {
        box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    }
    
    /* Sharper borders on high DPI */
    .border {
        border-width: 0.5px !important;
    }
}

/* Container Fluid Adjustments for Large Screens */
@media (min-width: 1400px) {
    .container-fluid {
        padding-left: 3rem;
        padding-right: 3rem;
    }
}

@media (min-width: 1600px) {
    .container-fluid {
        padding-left: 4rem;
        padding-right: 4rem;
    }
}

@media (min-width: 2000px) {
    .container-fluid {
        padding-left: 5rem;
        padding-right: 5rem;
    }
}

/* Ensure proper spacing for very large screens */
@media (min-width: 2400px) {
    .container,
    .container-lg,
    .container-md,
    .container-sm,
    .container-xl,
    .container-xxl {
        max-width: 2200px;
    }
    
    .container-fluid {
        padding-left: 6rem;
        padding-right: 6rem;
    }
}

/* Performance optimizations for large screens */
@media (min-width: 1400px) {
    /* Use GPU acceleration for smooth animations */
    .card,
    .btn,
    .nav-link {
        transform: translateZ(0);
        backface-visibility: hidden;
    }
    
    /* Optimize font rendering */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }
}

/* ====== UNIVERSAL THEME TOGGLE OPTIMIZATION ====== */

/* Theme Toggle Button Styling */
.theme-toggle,
#theme-toggle,
#authenticated-theme-toggle,
[data-theme-toggle] {
  background: var(--theme-btn-bg, rgba(0, 0, 0, 0.1)) !important;
  border: 1px solid var(--theme-btn-border, rgba(0, 0, 0, 0.2)) !important;
  border-radius: 50% !important;
  width: 40px !important;
  height: 40px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.3s ease !important;
  color: var(--text-primary) !important;
  position: relative !important;
  overflow: hidden !important;
}

.theme-toggle:hover,
#theme-toggle:hover,
#authenticated-theme-toggle:hover,
[data-theme-toggle]:hover {
  background: var(--theme-btn-hover, rgba(0, 0, 0, 0.15)) !important;
  transform: scale(1.1) !important;
  box-shadow: 0 4px 12px var(--shadow-medium) !important;
}

.theme-toggle:active,
#theme-toggle:active,
#authenticated-theme-toggle:active,
[data-theme-toggle]:active {
  transform: scale(0.95) !important;
}

.theme-toggle i,
#theme-toggle i,
#authenticated-theme-toggle i,
[data-theme-toggle] i {
  font-size: 16px !important;
  transition: all 0.3s ease !important;
}

/* Theme Toggle Animation */
.theme-toggle:hover i,
#theme-toggle:hover i,
#authenticated-theme-toggle:hover i,
[data-theme-toggle]:hover i {
  transform: rotate(15deg) !important;
}

/* Theme Toggle in Navbar Specific Styling */
.navbar .theme-toggle,
.navbar #theme-toggle,
.navbar #authenticated-theme-toggle {
  margin-right: 8px !important;
}

/* Ensure theme button works in all contexts */
.nav-link.theme-toggle {
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
}

.nav-link.theme-toggle:hover {
  background: var(--theme-btn-hover) !important;
}

/* Universal Theme Transition for Smooth Switching */
* {
  transition: background-color 0.3s ease, 
              color 0.3s ease, 
              border-color 0.3s ease,
              box-shadow 0.3s ease !important;
}

/* Performance Optimization for Theme Switching */
body[data-theme],
html[data-theme],
[data-theme] * {
  will-change: background-color, color, border-color;
}

/* ====== END THEME TOGGLE OPTIMIZATION ====== */
