/* ============================================
   THEME SYSTEM - Carpento Dark, Apex Light & Salient Blue
   ============================================ */

/* === DEFAULT THEME: CARPENTO DARK === */
:root {
  --primary-color: #C69453;
  --secondary-color: #6A6F78;
  --dark-bg: #24201F;
  --light-bg: #2d2926;
  --text-color: #7c858c;
  --heading-color: #ffffff;
  --link-color: #C69453;
  --link-hover: #d4a469;
  --border-color: #3d3935;
  --card-bg: #2d2926;
  --navbar-bg: #24201F;
  --footer-bg: #1a1715;
  --footer-text: #7c858c;
}

/* === APEX LIGHT THEME === */
body.theme-light {
  --primary-color: #FDA12B;
  --secondary-color: #8D9297;
  --dark-bg: #182333;
  --light-bg: #F8F9FA;
  --text-color: #666666;
  --heading-color: #182333;
  --link-color: #FDA12B;
  --link-hover: #e89020;
  --border-color: #e5e5e5;
  --card-bg: #ffffff;
  --navbar-bg: #ffffff;
  --footer-bg: #182333;
  --footer-text: #ffffff;
}

/* === SALIENT BLUE THEME === */
body.theme-salient {
  --primary-color: #2563EB;
  --secondary-color: #64748b;
  --dark-bg: #0f172a;
  --light-bg: #f8fafc;
  --text-color: #475569;
  --heading-color: #0f172a;
  --link-color: #2563EB;
  --link-hover: #1e40af;
  --border-color: #e2e8f0;
  --card-bg: #ffffff;
  --navbar-bg: #ffffff;
  --footer-bg: #0f172a;
  --footer-text: #cbd5e1;
}

/* === APPLY THEME VARIABLES === */

/* Backgrounds */
body {
  background-color: var(--light-bg) !important;
  color: var(--text-color) !important;
  transition: background-color 0.3s ease, color 0.3s ease;
  margin: 0 !important;
  padding: 0 !important;
  position: relative !important;
}

/* Ensure topbar stays in place */
.container-fluid.bg-light {
  position: relative !important;
  top: 0 !important;
  margin: 0 !important;
}

/* Override Bootstrap default light backgrounds */
.bg-white,
#spinner.bg-white {
  background-color: var(--card-bg) !important;
}

.bg-light,
.topbar {
  background-color: var(--light-bg) !important;
  color: var(--text-color) !important;
}

.bg-light * {
  color: var(--text-color) !important;
}

.topbar * {
  color: var(--text-color) !important;
}

/* Salient theme topbar override - white color for all topbar elements */
body.theme-salient .bg-light *,
body.theme-salient .topbar * {
  color: #ffffff !important;
}

/* Container backgrounds */
.container-fluid.bg-light {
  background-color: var(--light-bg) !important;
}

/* Navbar */
.navbar {
  background-color: var(--navbar-bg) !important;
  transition: background-color 0.3s ease;
  position: sticky !important;
  top: 0 !important;
  z-index: 1000;
  margin: 0 !important;
}

.navbar.sticky-top {
  position: sticky !important;
  top: 0 !important;
}

.navbar-light .navbar-nav .nav-link {
  color: var(--heading-color) !important;
}

.navbar-brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}

.navbar-light .navbar-brand h1 {
  color: var(--heading-color) !important;
  font-size: 1.16rem;
  line-height: 1.2;
  white-space: nowrap;
}

.navbar-subtitle {
  color: var(--primary-color) !important;
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 0.1rem;
  white-space: nowrap;
  width: 100%;
}

/* Navbar Toggler - Theme aware */
.navbar-toggler {
  border-color: var(--border-color) !important;
  background-color: transparent !important;
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 0.25rem rgba(var(--primary-color), 0.25) !important;
}

.navbar-toggler-icon {
  background-image: none !important;
  display: inline-block;
  width: 1.5em;
  height: 1.5em;
  vertical-align: middle;
  position: relative;
}

/* Create hamburger icon bars with theme colors */
.navbar-toggler-icon::before,
.navbar-toggler-icon::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--heading-color);
  transition: all 0.3s ease;
}

.navbar-toggler-icon::before {
  top: 0.35em;
}

.navbar-toggler-icon::after {
  bottom: 0.35em;
}

/* Middle bar using a pseudo element on wrapper */
.navbar-toggler-icon {
  background: linear-gradient(
    to bottom,
    transparent 40%,
    var(--heading-color) 40%,
    var(--heading-color) 60%,
    transparent 60%
  );
}

.navbar-toggler:hover {
  background-color: var(--light-bg) !important;
  opacity: 0.9;
}

/* Logo Styling - Hanging over content */
.logo-image {
  width: 108px;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  background-color: var(--card-bg);
  padding: 8px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  /* Logo hangs down over content below */
  position: relative;
  z-index: 1001;
  margin-top: 0;
  margin-bottom: -47px;
}

.logo-image:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.navbar-brand {
  display: flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
}

.navbar {
  /* Keep navbar slim */
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
  /* Allow logo to overflow */
  overflow: visible !important;
}

/* Responsive adjustments for larger screens */
@media (min-width: 992px) {
  .logo-image {
    width: 108px;
    margin-top: -20px;
    margin-bottom: -53px;
  }

  .navbar-light .navbar-brand h1 {
    font-size: 1.54rem;
  }

  .navbar-subtitle {
    font-size: .92rem;
  }
}

@media (min-width: 1200px) {
  .logo-image {
    width: 139px;
    margin-top: -40px;
    margin-bottom: -92px;
  }

  .navbar-light .navbar-brand h1 {
    font-size: 1.93rem;
  }

  .navbar-subtitle {
    font-size: 1.15rem;
  }
}

/* Buttons */
.btn-primary {
  background: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
}

.btn-primary:hover {
  background: var(--link-hover) !important;
  border-color: var(--link-hover) !important;
}

.btn-square {
  background: var(--primary-color) !important;
}

/* Text Colors */
h1, h2, h3, h4, h5, h6 {
  color: var(--heading-color) !important;
}

.text-primary {
  color: var(--primary-color) !important;
}

a {
  color: var(--link-color);
}

a:hover {
  color: var(--link-hover);
}

/* Cards & Service Items */
.service-item,
.team-item,
.testimonial-item {
  background-color: var(--card-bg) !important;
  transition: background-color 0.3s ease;
}

.service-text,
.team-text,
.testimonial-text {
  background-color: var(--card-bg) !important;
  position: relative !important;
  overflow: hidden !important;
}

/* Page Headers */
.page-header {
  background-color: var(--dark-bg) !important;
}

/* Override Bootstrap text color classes for dark theme */
.text-dark,
.text-body {
  color: var(--text-color) !important;
}

body.theme-light .text-dark,
body.theme-light .text-body {
  color: var(--heading-color) !important;
}

body.theme-light .topbar small,
body.theme-light .topbar a {
  color: var(--heading-color) !important;
}

/* Footer */
.footer {
  background-color: var(--footer-bg) !important;
}

.footer .text-light {
  color: var(--footer-text) !important;
}

body.theme-light .copyright {
  background-color: var(--light-bg) !important;
}

/* Forms */
.form-control,
.form-floating > .form-control,
.form-floating > .form-select {
  background-color: var(--card-bg) !important;
  color: var(--text-color) !important;
  border-color: var(--border-color) !important;
}

.form-floating > label {
  color: var(--text-color) !important;
}

/* Borders */
.border,
.border-start,
.border-end,
.border-top,
.border-bottom {
  border-color: var(--border-color) !important;
}

/* Breadcrumb */
.breadcrumb-item,
.breadcrumb-item a {
  color: rgba(255, 255, 255, 0.7) !important;
}

.breadcrumb-item.active {
  color: #ffffff !important;
}

/* Stats/Facts Section */
.facts {
  background-color: var(--primary-color) !important;
}

/* Icon Badges */
.bg-primary {
  background-color: var(--primary-color) !important;
}

/* Theme Toggle Button Styles */
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 1rem 0 0 1rem;
  background: var(--primary-color);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  transform: scale(1.1);
  background: var(--link-hover);
}

.theme-toggle i {
  color: white;
  font-size: 18px;
}

/* Smooth transitions for theme switching */
* {
  transition-property: background-color, color, border-color;
  transition-duration: 0.3s;
  transition-timing-function: ease;
}

/* Don't animate transforms and other properties */
*:not(.theme-toggle) {
  transition-property: background-color, color, border-color;
}

/* Light theme specific adjustments */
body.theme-light .carousel-caption h1,
body.theme-light .carousel-caption h5 {
  color: #ffffff !important;
}

body.theme-light .display-1,
body.theme-light .display-2,
body.theme-light .display-3,
body.theme-light .display-4,
body.theme-light .display-5,
body.theme-light .display-6 {
  color: var(--heading-color) !important;
}

body.theme-light .text-white {
  color: #ffffff !important;
}

body.theme-light p {
  color: var(--text-color);
}

body.theme-light .bg-white {
  background-color: var(--card-bg) !important;
}

/* Salient theme specific adjustments */
body.theme-salient .logo-image {
  content: url('/img/reno-masters-logo-5.png') !important;
}

@media (min-width: 992px) {
  body.theme-salient .logo-image {
    margin-top: -53px;
  }
}

@media (min-width: 1200px) {
  body.theme-salient .logo-image {
    margin-top: -53px !important;
  }
}

body.theme-salient .carousel-caption {
  background: rgba(0, 0, 0, .35) !important;
}
body.theme-salient .page-header {
  background: linear-gradient(rgba(0, 0, 0, .35), rgba(0, 0, 0, .35)), url(../img/carousel-1.jpg) center center no-repeat !important;
  background-size: cover !important;
}

/* Gallery page header uses carousel-2 for Salient theme */
body.theme-salient .page-header.gallery-header {
  background: linear-gradient(rgba(0, 0, 0, .35), rgba(0, 0, 0, .35)), url(../img/carousel-2.jpg) center center no-repeat !important;
  background-size: cover !important;
}

/* About page uses carousel-5 (couple polishing wood) for Salient theme */
body.theme-salient .page-header.about-header {
  background: linear-gradient(rgba(0, 0, 0, .35), rgba(0, 0, 0, .35)), url(../img/carousel-5.jpg) center center no-repeat !important;
  background-size: cover !important;
}

/* Contact page uses carousel-3 for Salient theme */
body.theme-salient .page-header.contact-header {
  background: linear-gradient(rgba(0, 0, 0, .35), rgba(0, 0, 0, .35)), url(../img/carousel-3.jpg) center center no-repeat !important;
  background-size: cover !important;
}

/* Services pages use carousel-4 (door renovation) for Salient theme */
body.theme-salient .page-header.services-header {
  background: linear-gradient(rgba(0, 0, 0, .35), rgba(0, 0, 0, .35)), url(../img/carousel-4.jpg) center center no-repeat !important;
  background-size: cover !important;
}

body.theme-salient .carousel-caption h1,
body.theme-salient .carousel-caption h5 {
  color: #ffffff !important;
}

body.theme-salient .display-1,
body.theme-salient .display-2,
body.theme-salient .display-3,
body.theme-salient .display-4,
body.theme-salient .display-5,
body.theme-salient .display-6 {
  color: var(--heading-color) !important;
}

body.theme-salient .text-white {
  color: #ffffff !important;
}

body.theme-salient p {
  color: var(--text-color);
}

body.theme-salient .bg-white {
  background-color: var(--card-bg) !important;
}

body.theme-salient .text-dark,
body.theme-salient .text-body {
  color: var(--heading-color) !important;
}

body.theme-salient .topbar small,
body.theme-salient .topbar a {
  color: #ffffff !important;
}

body.theme-salient .topbar .btn-square {
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

body.theme-salient .topbar .btn-square:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

body.theme-salient .topbar i {
  color: #ffffff !important;
}

body.theme-salient .topbar .btn-square i {
  color: #ffffff !important;
}

body.theme-salient .topbar .fab {
  color: #ffffff !important;
}

body.theme-salient .copyright {
  background-color: var(--light-bg) !important;
}

body.theme-salient .footer,
body.theme-salient .footer *,
body.theme-salient .footer .text-light,
body.theme-salient .footer a,
body.theme-salient .footer h5 {
  color: #e2e8f0 !important;
}

body.theme-salient .carousel-control-prev-icon,
body.theme-salient .carousel-control-next-icon {
  filter: brightness(1.5) !important;
}

body.theme-salient .service-item {
  background-color: var(--card-bg) !important;
}

body.theme-salient .service-text {
  background-color: var(--card-bg) !important;
}

body.theme-salient .service-item:hover {
  background-color: #2563EB !important;
}

body.theme-salient .service-item:hover .service-text,
body.theme-salient .service-text:hover {
  background-color: #2563EB !important;
}

body.theme-salient .service-item:hover h5,
body.theme-salient .service-item:hover p,
body.theme-salient .service-item:hover .btn,
body.theme-salient .service-item:hover i,
body.theme-salient .service-item:hover a,
body.theme-salient .service-item:hover .text-primary,
body.theme-salient .service-item:hover .service-text .text-primary {
  color: #ffffff !important;
}

body.theme-salient .service-item:hover .btn-square {
  background-color: rgba(255, 255, 255, 0.2) !important;
}

body.theme-salient .service-item:hover .bg-primary {
  background-color: rgba(255, 255, 255, 0.2) !important;
}

body.theme-salient .service-item,
body.theme-salient .service-text {
  transition: background-color 0.3s ease !important;
}

body.theme-salient .service-item .bg-primary,
body.theme-salient .service-item .btn-square {
  transition: background-color 0.3s ease !important;
}

/* Fix carousel indicator dots for Salient theme */
body.theme-salient .carousel-indicators button {
  background-color: var(--primary-color) !important;
}

body.theme-salient .carousel-indicators button.active {
  background-color: #ffffff !important;
}

/* Fix breadcrumb separator dots for Salient theme */
body.theme-salient .breadcrumb-item + .breadcrumb-item::before {
  color: #ffffff !important;
}

/* CRITICAL: Override topbar * rule for Salient theme - must be at the end */
body.theme-salient .topbar *,
body.theme-salient .topbar a *,
body.theme-salient .topbar .btn-square *,
body.theme-salient .topbar .btn-square i,
body.theme-salient .topbar i,
body.theme-salient .topbar .fab,
body.theme-salient .topbar .fa-facebook-f,
body.theme-salient .topbar .fa-instagram {
  color: #ffffff !important;
}

/* ============================================
   MOBILE FIXES
   ============================================ */

/* Fix 1: Make hamburger menu more visible on mobile */
@media (max-width: 991.98px) {
  .navbar-toggler {
    padding: 0.25rem;
    border: 1px solid var(--heading-color) !important;
    background-color: var(--light-bg) !important;
    opacity: 1 !important;
    display: block !important;
    position: absolute !important;
    top: 10px !important;
    right: 15px !important;
    z-index: 1050 !important;
    width: 30px !important;
    height: 30px !important;
  }

  .navbar-toggler-icon {
    width: 0.75em !important;
    height: 0.75em !important;
  }

  .navbar-toggler-icon::before,
  .navbar-toggler-icon::after {
    background-color: var(--heading-color) !important;
    height: 2px !important;
  }

  .navbar-toggler-icon {
    background: linear-gradient(
      to bottom,
      transparent 40%,
      var(--heading-color) 40%,
      var(--heading-color) 60%,
      transparent 60%
    ) !important;
  }

  /* Ensure navbar has proper positioning context */
  .navbar {
    position: relative !important;
  }
}

/* Fix 2: Make "Read More" text theme-aware */
.btn.btn-sm,
.service-text .btn {
  color: var(--text-color) !important;
}

.service-item:hover .btn.btn-sm,
.service-item:hover .service-text .btn {
  color: #FFFFFF !important;
}

body.theme-light .btn.btn-sm,
body.theme-light .service-text .btn {
  color: var(--heading-color) !important;
}

body.theme-light .service-item:hover .btn.btn-sm,
body.theme-light .service-item:hover .service-text .btn {
  color: #FFFFFF !important;
}

/* Fix 3: Reduce "25 Years Experience" square size on mobile */
@media (max-width: 768px) {
  .position-absolute.top-0.start-0.bg-white {
    width: 120px !important;
    height: 120px !important;
  }

  .position-absolute.top-0.start-0.bg-white h1 {
    font-size: 1.5rem !important;
  }

  .position-absolute.top-0.start-0.bg-white h2 {
    font-size: 1rem !important;
  }

  .position-absolute.top-0.start-0.bg-white h5 {
    font-size: 0.8rem !important;
  }

  .position-absolute.top-0.start-0.bg-white .p-3 {
    padding: 0.5rem !important;
  }
}

/* Fix 4: Make hero/carousel titles 20% smaller */
.carousel-caption h5 {
  font-size: 0.8rem !important;
}

.carousel-caption h1.display-2 {
  font-size: 2.8rem !important;
}

@media (min-width: 768px) {
  .carousel-caption h5 {
    font-size: 1rem !important;
  }

  .carousel-caption h1.display-2 {
    font-size: 3.2rem !important;
  }
}

@media (min-width: 1024px) {
  .carousel-caption h5 {
    font-size: 1.2rem !important;
  }

  .carousel-caption h1.display-2 {
    font-size: 3.52rem !important;
  }
}
