/* ========================================
   UNIFIED PAGE TITLES SYSTEM
   Modern, professional page title styling for all inner pages
   Jinan University Design System
   ======================================== */

/* Import CSS Variables */
@import url("theme-variables.css");

/* ========================================
   MAIN PAGE TITLE COMPONENT
   Primary title used on all inner pages
   ======================================== */

.unified-page-title {
  /* Typography */
  font-family: var(--font-headings, "Lato", "Droid Arabic Kufi", sans-serif);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;

  /* Colors */
  color: var(--jinan-teal, #316667);

  /* Layout */
  margin: 0 0 1.5rem 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;

  /* Modern enhancements */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Icon styling within title */
.unified-page-title .title-icon {
  font-size: 0.8em;
  color: var(--jinan-gold, #cd9933);
  opacity: 0.9;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.unified-page-title:hover .title-icon {
  opacity: 1;
  transform: scale(1.05);
}

/* ========================================
   TITLE VARIATIONS
   Different styles for different contexts
   ======================================== */

/* Centered variation */
.unified-page-title.text-center {
  justify-content: center;
  text-align: center;
}

/* Right-aligned variation (for RTL) */
.unified-page-title.text-end {
  justify-content: flex-end;
  text-align: right;
  direction: rtl;
}

/* Left-aligned variation (default) */
.unified-page-title.text-start {
  justify-content: flex-start;
  text-align: left;
}

/* Hero variation - larger and more prominent */
.unified-page-title.hero-variant {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  margin-bottom: 2rem;
  background: linear-gradient(
    135deg,
    var(--jinan-teal, #316667) 0%,
    #2a5a5b 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Compact variation - smaller for dense layouts */
.unified-page-title.compact-variant {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 1rem;
  gap: 0.5rem;
}

/* ========================================
   TITLE DECORATIONS
   Professional accent elements
   ======================================== */

/* Modern underline decoration */
.title-decoration {
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--jinan-gold, #cd9933) 0%,
    var(--jinan-gold, #cd9933) 80%,
    transparent 100%
  );
  border: none;
  border-radius: 2px;
  margin: 0 0 2rem 0;
  max-width: 80px;
  opacity: 0.9;
}

/* Center aligned decoration */
.title-decoration.text-center {
  margin-left: auto;
  margin-right: auto;
}

/* Right aligned decoration */
.title-decoration.text-end {
  margin-left: auto;
  margin-right: 0;
}

/* Alternative decoration with gradient */
.title-decoration.gradient-variant {
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--jinan-teal, #316667) 0%,
    var(--jinan-gold, #cd9933) 50%,
    var(--jinan-teal, #316667) 100%
  );
  max-width: 120px;
}

/* ========================================
   PAGE HEADER CONTAINER
   Complete header section with background
   ======================================== */

.page-header-section {
  background: linear-gradient(135deg, #f8fffe 0%, #ffffff 100%);
  padding: 2.5rem 0;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.page-header-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--jinan-teal, #316667),
    transparent
  );
  opacity: 0.2;
}

.page-header-section::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--jinan-gold, #cd9933),
    transparent
  );
  opacity: 0.3;
}

/* Header content styling */
.page-header-content {
  position: relative;
  z-index: 2;
}

/* Optional breadcrumb styling */
.page-breadcrumb {
  margin-bottom: 1rem;
  padding: 0;
  background: transparent;
  font-size: 0.9rem;
}

.page-breadcrumb .breadcrumb-item a {
  color: var(--jinan-teal, #316667);
  text-decoration: none;
  transition: color 0.3s ease;
}

.page-breadcrumb .breadcrumb-item a:hover {
  color: var(--jinan-gold, #cd9933);
}

.page-breadcrumb .breadcrumb-item.active {
  color: var(--text-muted, #6c757d);
}

/* ========================================
   RESPONSIVE DESIGN
   Mobile-first responsive adjustments
   ======================================== */

@media (max-width: 768px) {
  .unified-page-title {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }

  .unified-page-title.text-start,
  .unified-page-title.text-end {
    justify-content: center;
    text-align: center;
  }

  .page-header-section {
    padding: 1.5rem 0;
    margin-bottom: 1.5rem;
  }

  .title-decoration {
    margin-left: auto;
    margin-right: auto;
    max-width: 60px;
  }
}

@media (max-width: 576px) {
  .unified-page-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }

  .unified-page-title.hero-variant {
    font-size: 2rem;
  }

  .page-header-section {
    padding: 1rem 0;
  }
}

/* ========================================
   RTL LANGUAGE SUPPORT
   Arabic language optimizations
   ======================================== */

html[lang="ar"] .unified-page-title,
html[data-lang="ar"] .unified-page-title {
  font-family: "Droid Arabic Kufi", "Lato", sans-serif;
  direction: rtl;
  text-align: right;
  justify-content: flex-end;
}

html[lang="ar"] .unified-page-title .title-icon,
html[data-lang="ar"] .unified-page-title .title-icon {
  order: -1;
  margin-left: 0;
  margin-right: 0.75rem;
}

html[lang="ar"] .title-decoration,
html[data-lang="ar"] .title-decoration {
  margin-left: auto;
  margin-right: 0;
}

/* ========================================
   ACCESSIBILITY ENHANCEMENTS
   Screen reader and keyboard navigation
   ======================================== */

.unified-page-title:focus {
  outline: 2px solid var(--jinan-gold, #cd9933);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .unified-page-title {
    color: #000;
  }

  .unified-page-title .title-icon {
    color: #000;
  }

  .title-decoration {
    background: #000;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .unified-page-title .title-icon {
    transition: none;
  }

  .unified-page-title:hover .title-icon {
    transform: none;
  }
}

/* ========================================
   PRINT STYLES
   Optimized for printing
   ======================================== */

@media print {
  .unified-page-title {
    color: #000 !important;
    font-size: 1.5rem !important;
  }

  .unified-page-title .title-icon {
    display: none;
  }

  .title-decoration {
    background: #000 !important;
    height: 2px !important;
  }

  .page-header-section {
    background: none !important;
    padding: 1rem 0 !important;
  }

  .page-header-section::before,
  .page-header-section::after {
    display: none;
  }
}

/* ========================================
   LEGACY COMPATIBILITY
   Backward compatibility with existing classes
   ======================================== */

/* Map old classes to new system */
.main-page-title {
  @extend .unified-page-title;
}

.page-title {
  @extend .unified-page-title;
}

.majors-page-title {
  @extend .unified-page-title;
}

/* Alternative without @extend for broader compatibility */
.main-page-title,
.page-title,
.majors-page-title {
  font-family: var(--font-headings, "Lato", "Droid Arabic Kufi", sans-serif);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--jinan-teal, #316667);
  margin: 0 0 1.5rem 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Icons in legacy classes */
.main-page-title i,
.page-title i,
.majors-page-title i {
  font-size: 0.8em;
  color: var(--jinan-gold, #cd9933);
  opacity: 0.9;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

/* Legacy title divider */
.main-title-divider {
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--jinan-gold, #cd9933) 0%,
    var(--jinan-gold, #cd9933) 80%,
    transparent 100%
  );
  border: none;
  border-radius: 2px;
  margin: 0 0 2rem 0;
  max-width: 80px;
  opacity: 0.9;
}

/* Legacy alignment classes */
.main-page-title.text-center,
.page-title.text-center,
.majors-page-title.text-center {
  justify-content: center;
  text-align: center;
}

.main-page-title.text-end,
.page-title.text-end,
.majors-page-title.text-end {
  justify-content: flex-end;
  text-align: right;
  direction: rtl;
}

.main-page-title.text-start,
.page-title.text-start,
.majors-page-title.text-start {
  justify-content: flex-start;
  text-align: left;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS FOR LEGACY
   ======================================== */

@media (max-width: 768px) {
  .main-page-title,
  .page-title,
  .majors-page-title {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }

  .main-page-title.text-start,
  .main-page-title.text-end,
  .page-title.text-start,
  .page-title.text-end,
  .majors-page-title.text-start,
  .majors-page-title.text-end {
    justify-content: center;
    text-align: center;
  }

  .main-title-divider {
    margin-left: auto;
    margin-right: auto;
    max-width: 60px;
  }
}

/* ========================================
   RTL SUPPORT FOR LEGACY CLASSES
   ======================================== */

html[lang="ar"] .main-page-title,
html[data-lang="ar"] .main-page-title,
html[lang="ar"] .page-title,
html[data-lang="ar"] .page-title,
html[lang="ar"] .majors-page-title,
html[data-lang="ar"] .majors-page-title {
  font-family: "Droid Arabic Kufi", "Lato", sans-serif;
  direction: rtl;
  text-align: right;
  justify-content: flex-end;
}

html[lang="ar"] .main-page-title i,
html[data-lang="ar"] .main-page-title i,
html[lang="ar"] .page-title i,
html[data-lang="ar"] .page-title i,
html[lang="ar"] .majors-page-title i,
html[data-lang="ar"] .majors-page-title i {
  order: -1;
  margin-left: 0;
  margin-right: 0.75rem;
}

html[lang="ar"] .main-title-divider,
html[data-lang="ar"] .main-title-divider {
  margin-left: auto;
  margin-right: 0;
}
