/* Global Fixes for All Pages */

/* Fix inconsistent spacing and alignment */
:root {
  --section-spacing: 10rem;
  --element-spacing: 2rem;
  --card-padding: 3rem;
  --container-padding: 2rem;
  --border-radius-standard: 8px;
  --transition-standard: all 0.3s ease;
  --shadow-standard: 0 10px 30px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.15);
  --z-index-loader: 10000;
  --z-index-cursor: 9999;
  --z-index-overlay: 9998;
  --z-index-header: 1000;
  --z-index-nav: 999;
  --z-index-dropdown: 998;
  --z-index-modal: 997;
  --z-index-tooltip: 996;
  --z-index-scroll: 995;
  --z-index-back-to-top: 994;
}

[data-theme="dark"] {
  --shadow-standard: 0 10px 30px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.4);
}

/* Fix container consistency */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

/* Fix section spacing consistency */
section {
  padding: var(--section-spacing) 0;
  position: relative;
}

/* Fix card styling consistency */
.project-card,
.service-card,
.testimonial-card,
.principle-card,
.skill-item,
.interest-item,
.award-item,
.publication-item,
.collaboration-item,
.faq-item,
.contact-form-container {
  border-radius: var(--border-radius-standard);
  box-shadow: var(--shadow-standard);
  transition: var(--transition-standard);
  overflow: hidden;
}

.project-card:hover,
.service-card:hover,
.testimonial-card:hover,
.principle-card:hover,
.skill-item:hover,
.interest-item:hover,
.award-item:hover,
.publication-item:hover,
.collaboration-item:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-hover);
}

/* Fix button consistency */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem 2.4rem;
  font-size: 1.6rem;
  font-weight: 500;
  border-radius: var(--border-radius-standard);
  transition: var(--transition-standard);
  cursor: pointer;
  border: none;
  outline: none;
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Fix image consistency */
img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: inherit;
}

/* Fix form element consistency */
input,
textarea,
select {
  width: 100%;
  padding: 1.2rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-standard);
  font-family: var(--font-family);
  font-size: 1.6rem;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: var(--transition-standard);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2);
}

/* Fix typography consistency */
h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: 1.2;
  margin-bottom: 1.5rem;
  font-weight: 700;
}

p {
  margin-bottom: 1.5rem;
}

/* Fix animation consistency */
.animated {
  animation-duration: 0.8s;
  animation-fill-mode: both;
}

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

/* Fix focus states for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Fix cursor on touch devices */
@media (hover: none) {
  .cursor-outer,
  .cursor-inner {
    display: none !important;
  }
}

/* Fix header consistency */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: var(--z-index-header);
  transition: var(--transition-standard);
  padding: 2rem;
}

header.scrolled {
  background-color: var(--bg-color);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  padding: 1.5rem 2rem;
}

[data-theme="dark"] header.scrolled {
  background-color: var(--dark-bg);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

/* Fix footer consistency */
footer {
  background-color: var(--bg-color-alt);
  padding: 8rem 0 2rem;
}

[data-theme="dark"] footer {
  background-color: var(--dark-bg-alt);
}

/* Fix page transition overlay */
.page-transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--primary-color);
  z-index: var(--z-index-overlay);
  transform: translateY(100%);
  transition: transform 0.6s cubic-bezier(0.77, 0, 0.175, 1);
}

.page-transition-overlay.active {
  transform: translateY(0);
}

.page-transition-overlay.fade-out {
  transform: translateY(-100%);
}

/* Fix scroll progress bar */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  width: 0%;
  z-index: var(--z-index-scroll);
  transition: width 0.1s linear;
}

/* Fix back to top button */
.back-to-top {
  position: fixed;
  bottom: 3rem;
  right: 3rem;
  width: 5rem;
  height: 5rem;
  background-color: var(--primary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-standard);
  z-index: var(--z-index-back-to-top);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.back-to-top.active {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background-color: var(--secondary-color);
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* Fix loader */
.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: var(--z-index-loader);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader.hidden {
  opacity: 0;
  visibility: hidden;
}

/* Fix page header */
.page-header {
  position: relative;
  padding: 15rem 0 8rem;
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.1) 0%, rgba(255, 51, 102, 0.1) 100%);
  overflow: hidden;
}

[data-theme="dark"] .page-header {
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.2) 0%, rgba(255, 51, 102, 0.2) 100%);
}

/* Fix breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  font-size: 1.6rem;
  margin-top: 1rem;
}

.breadcrumbs a {
  color: var(--text-color-light);
  transition: color 0.3s ease;
}

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

.breadcrumb-separator {
  margin: 0 1rem;
  color: var(--text-color-light);
}

.current-page {
  color: var(--primary-color);
  font-weight: 500;
}

/* Fix section headers */
.section-header {
  text-align: center;
  margin-bottom: 5rem;
}

.section-title {
  font-size: 4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.section-line {
  width: 8rem;
  height: 0.3rem;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  margin: 0 auto 1.5rem;
}

.section-subtitle {
  font-size: 1.8rem;
  color: var(--text-color-light);
}

/* Fix CTA sections */
.cta {
  position: relative;
  padding: 8rem 0;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  overflow: hidden;
}

.cta-content {
  position: relative;
  text-align: center;
  color: white;
}

.cta-title {
  font-size: 4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.cta-text {
  font-size: 1.8rem;
  margin-bottom: 3rem;
  max-width: 60rem;
  margin-left: auto;
  margin-right: auto;
}

/* Fix responsive issues */
@media screen and (max-width: 992px) {
  :root {
    --section-spacing: 8rem;
    --card-padding: 2.5rem;
  }

  .section-title {
    font-size: 3.5rem;
  }

  .cta-title {
    font-size: 3.5rem;
  }
}

@media screen and (max-width: 768px) {
  :root {
    --section-spacing: 6rem;
    --card-padding: 2rem;
  }

  .section-title {
    font-size: 3rem;
  }

  .cta-title {
    font-size: 3rem;
  }
}

@media screen and (max-width: 576px) {
  :root {
    --section-spacing: 5rem;
    --card-padding: 1.5rem;
  }

  .section-title {
    font-size: 2.8rem;
  }

  .cta-title {
    font-size: 2.8rem;
  }
}

/* Fix header and navigation visibility */
nav {
  z-index: var(--z-index-nav);
}

/* Fix theme toggle and color scheme toggle */
.theme-toggle,
.color-scheme-toggle {
  position: relative;
  z-index: var(--z-index-header);
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

/* Fix navigation toggle for mobile */
.nav-toggle {
  z-index: var(--z-index-header);
}

/* Fix for nav-toggle-bar */
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  content: "";
  width: 100%;
  height: 2px;
  background-color: var(--text-color);
  position: absolute;
  left: 0;
  transition: var(--transition);
}

.nav-toggle-bar::before {
  top: -8px;
}

.nav-toggle-bar::after {
  bottom: -8px;
}

/* Fix for dark mode transitions */
body,
header,
nav,
.theme-toggle,
.color-scheme-toggle,
.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  transition: all 0.3s ease;
}

/* Fix for dynamic background */
#dynamic-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}
