/* ==========================================
   🎨 MODERN BUILDING HEIGHTS EXTRACTION HUB
   Custom CSS with Animations & Modern Design
   ========================================== */

/* === ROOT VARIABLES === */
:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --accent-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --success-gradient: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
  --warning-gradient: linear-gradient(135deg, #ff9a56 0%, #ffad56 100%);
  
  --shadow-light: 0 2px 10px rgba(0,0,0,0.1);
  --shadow-medium: 0 8px 30px rgba(0,0,0,0.12);
  --shadow-heavy: 0 20px 40px rgba(0,0,0,0.15);
  
  --border-radius-sm: 6px;
  --border-radius-md: 10px;
  --border-radius-lg: 16px;
  
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === GLOBAL ANIMATIONS === */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

/* === SMOOTH SCROLLING === */
html {
  scroll-behavior: smooth;
}

/* === LOGO ENHANCEMENTS === */
.md-header__button.md-logo {
  transition: var(--transition-normal);
  padding: 0.2rem;
}

.md-header__button.md-logo:hover {
  transform: scale(1.1);
  animation: pulse 1s ease-in-out;
}

.md-header__button.md-logo img,
.md-header__button.md-logo svg {
  width: 48px !important;
  height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: var(--transition-normal);
}

.md-header__button.md-logo:hover img,
.md-header__button.md-logo:hover svg {
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
  filter: brightness(1.1);
}

/* === ENHANCED LOGO FOR SIDEBAR === */
.md-nav__title .md-nav__button img {
  width: 32px !important;
  height: 32px !important;
  border-radius: 6px;
  margin-right: 8px;
}

/* === LOGO IN NAVIGATION === */
.md-nav--primary .md-nav__title {
  background: var(--primary-gradient);
  color: white;
  padding: 1rem;
  margin-bottom: 0.5rem;
  border-radius: 0 0 12px 12px;
  position: relative;
  overflow: hidden;
}

.md-nav--primary .md-nav__title::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: var(--transition-slow);
}

.md-nav--primary .md-nav__title:hover::before {
  left: 100%;
}

/* === HEADER ENHANCEMENTS === */
.md-header {
  background: var(--primary-gradient) !important;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-medium);
  transition: var(--transition-normal);
}

.md-header--shadow {
  box-shadow: var(--shadow-heavy);
}

.md-header__title {
  font-weight: 700;
  animation: fadeInLeft 0.8s ease-out;
}

/* === NAVIGATION ENHANCEMENTS === */
.md-nav {
  animation: fadeInLeft 0.6s ease-out;
}

.md-nav__item {
  transition: var(--transition-fast);
}

.md-nav__item:hover {
  transform: translateX(5px);
}

.md-nav__link {
  transition: var(--transition-fast);
  border-radius: var(--border-radius-sm);
  position: relative;
  overflow: hidden;
}

.md-nav__link:hover {
  background: linear-gradient(90deg, 
    rgba(102, 126, 234, 0.1) 0%, 
    rgba(118, 75, 162, 0.1) 100%);
  transform: translateX(3px);
}

.md-nav__link::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: var(--transition-normal);
}

.md-nav__link:hover::before {
  left: 100%;
}

/* === CONTENT AREA ENHANCEMENTS === */
.md-content {
  animation: fadeInUp 0.8s ease-out;
}

.md-content__inner {
  max-width: 1200px;
  margin: 0 auto;
}

/* === HERO SECTIONS WITH GRADIENTS === */
div[style*="linear-gradient"] {
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-medium);
  animation: fadeInUp 0.8s ease-out;
  transition: var(--transition-normal);
}

div[style*="linear-gradient"]:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-heavy);
}

div[style*="linear-gradient"]::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, 
    rgba(255, 255, 255, 0.1) 0%, 
    transparent 70%);
  opacity: 0;
  transition: var(--transition-slow);
  pointer-events: none;
}

div[style*="linear-gradient"]:hover::before {
  opacity: 1;
  animation: float 2s ease-in-out infinite;
}

/* === CARD ENHANCEMENTS === */
.md-typeset div[style*="background: #"] {
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.md-typeset div[style*="background: #"]:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-medium);
}

/* === TABLE ENHANCEMENTS === */
.md-typeset table {
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-light);
  animation: fadeInUp 0.6s ease-out;
  margin: 2rem 0;
}

.md-typeset table th {
  background: var(--primary-gradient);
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1rem;
}

.md-typeset table tr {
  transition: var(--transition-fast);
}

.md-typeset table tr:hover {
  background: rgba(102, 126, 234, 0.05);
  transform: scale(1.01);
}

.md-typeset table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* === CODE BLOCKS === */
.md-typeset .highlight {
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-light);
  animation: fadeInUp 0.6s ease-out;
  transition: var(--transition-normal);
}

.md-typeset .highlight:hover {
  box-shadow: var(--shadow-medium);
  transform: translateY(-2px);
}

.md-typeset pre {
  border-radius: var(--border-radius-md);
}

.md-typeset code {
  background: rgba(102, 126, 234, 0.1);
  border-radius: var(--border-radius-sm);
  padding: 0.2em 0.4em;
  font-weight: 500;
}

/* === BUTTONS AND LINKS === */
.md-typeset a {
  transition: var(--transition-fast);
  position: relative;
}

.md-typeset a:hover {
  transform: translateY(-1px);
}

.md-typeset a[href^="http"]::after {
  content: "🔗";
  opacity: 0;
  transition: var(--transition-fast);
  margin-left: 4px;
}

.md-typeset a[href^="http"]:hover::after {
  opacity: 1;
}

/* === SEARCH ENHANCEMENTS === */
.md-search {
  transition: var(--transition-normal);
}

.md-search__form {
  border-radius: 25px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  transition: var(--transition-normal);
}

.md-search__form:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.02);
}

.md-search__input {
  border-radius: 25px;
}

/* === FOOTER ENHANCEMENTS === */
.md-footer {
  background: var(--primary-gradient);
  animation: fadeInUp 0.8s ease-out;
}

/* === MOBILE LOGO ENHANCEMENTS === */
@media (max-width: 768px) {
  .md-header__button.md-logo img,
  .md-header__button.md-logo svg {
    width: 40px !important;
    height: 40px !important;
  }
}

/* === DESKTOP LARGE LOGO === */
@media (min-width: 1200px) {
  .md-header__button.md-logo img,
  .md-header__button.md-logo svg {
    width: 56px !important;
    height: 56px !important;
  }
}

/* === LOGO BRANDING ENHANCEMENT === */
.md-header__button.md-logo {
  margin-right: 0.5rem;
  position: relative;
}

.md-header__button.md-logo::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, transparent, rgba(102, 126, 234, 0.3), transparent);
  border-radius: 10px;
  opacity: 0;
  transition: var(--transition-normal);
  z-index: -1;
}

.md-header__button.md-logo:hover::after {
  opacity: 1;
  animation: shimmer 2s infinite;
}

/* === FALLBACK ICON STYLING === */
.md-header__button.md-logo .md-icon {
  width: 48px !important;
  height: 48px !important;
  font-size: 2rem !important;
  color: white;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: var(--transition-normal);
}

.md-header__button.md-logo:hover .md-icon {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
  transform: rotate(5deg) scale(1.05);
}

/* === ENHANCED SIDEBAR LOGO === */
.md-nav--primary .md-nav__title .md-nav__button .md-icon {
  width: 32px !important;
  height: 32px !important;
  font-size: 1.5rem !important;
  background: rgba(255,255,255,0.1);
  border-radius: 6px;
  margin-right: 8px;
}
.md-header__title {
  margin-left: 0.5rem;
  font-size: 1.2em !important;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
@media (max-width: 768px) {
  .md-nav__item:hover {
    transform: none;
  }
  
  div[style*="linear-gradient"]:hover {
    transform: none;
  }
  
  .md-typeset table tr:hover {
    transform: none;
  }
}

/* === SCROLL ANIMATIONS === */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: var(--transition-slow);
}

.animate-on-scroll.animated {
  opacity: 1;
  transform: translateY(0);
}

/* === LOADING STATES === */
.loading {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
}

/* === EMOJI ANIMATIONS === */
.md-typeset h1:first-child::before,
.md-typeset h2::before {
  display: inline-block;
  animation: pulse 2s infinite;
  margin-right: 8px;
}

/* === PROGRESS INDICATORS === */
.progress-bar {
  height: 4px;
  background: var(--primary-gradient);
  border-radius: 2px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: var(--transition-fast);
}

/* === TOOLTIP ENHANCEMENTS === */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]:before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-fast);
  z-index: 1000;
}

[data-tooltip]:hover:before {
  opacity: 1;
  transform: translateX(-50%) translateY(-5px);
}

/* === CUSTOM SCROLLBAR === */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

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

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

/* === PRINT STYLES === */
@media print {
  .md-header,
  .md-sidebar,
  .md-footer {
    display: none !important;
  }
  
  .md-content {
    margin: 0 !important;
  }
  
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* === ACCESSIBILITY IMPROVEMENTS === */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* === DARK MODE SPECIFIC STYLES === */
[data-md-color-scheme="slate"] {
  --shadow-light: 0 2px 10px rgba(0,0,0,0.3);
  --shadow-medium: 0 8px 30px rgba(0,0,0,0.4);
  --shadow-heavy: 0 20px 40px rgba(0,0,0,0.5);
}

[data-md-color-scheme="slate"] .md-typeset code {
  background: rgba(102, 126, 234, 0.2);
}

[data-md-color-scheme="slate"] .md-search__form {
  background: rgba(255, 255, 255, 0.05);
}

[data-md-color-scheme="slate"] .md-search__form:hover {
  background: rgba(255, 255, 255, 0.1);
}
