/* Base Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    color: #111;
    background-color: #f8f9fa;
    line-height: 1.5;
}

/* Layout */
.templates-container {
    padding: 120px 40px 40px;
    min-height: 100vh;
    background: url('waterfall.jpg') center/cover no-repeat fixed;
    position: relative;
}

.background-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 0;
}

.content {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.page-title {
    font-size: 36px;
    margin-bottom: 16px;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    font-weight: 700;
}

/* Filters */
.filters-container {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    cursor: pointer;
    font-weight: 500;
    font-family: inherit;
    font-size: 15px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    text-transform: capitalize;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.filter-btn.active {
    background: #fff;
    color: #111;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-bottom: 32px;
}

.card {
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    position: relative;
    aspect-ratio: 16/10;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Hover Overlay */
.card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none; /* Inherited from Next.js implementation, allows hover to trigger safely */
}

/* Use parent hover to show overlay */
.card:hover .card-overlay {
    opacity: 1;
    pointer-events: auto; /* Re-enable clicks when visible */
}

.card-title {
    margin: 0;
    color: #111;
    font-size: 24px;
    text-align: center;
    padding: 0 20px;
    font-weight: 600;
}

.preview-btn {
    padding: 12px 32px;
    background: #111;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.1s ease, background 0.2s ease;
}

.preview-btn:hover {
    background: #000;
    transform: translateY(-1px);
}

.card-category {
    opacity: 0.6;
    font-size: 14px;
    color: #111;
    text-transform: capitalize;
}

/* Inline Preview Container */
.preview-container {
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    overflow: hidden;
    height: 80vh;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    background: #fff;
    margin-top: 32px;
    scroll-margin-top: 40px; /* For smooth scrolling padding */
}

.preview-container.hidden {
    display: none;
}

.preview-header {
    padding: 16px 24px;
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-title {
    color: #111;
    font-size: 16px;
}

.preview-title strong {
    font-weight: 600;
    text-transform: capitalize;
}

.preview-link {
    color: #111;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
}

.preview-link:hover {
    text-decoration: underline;
}

.preview-iframe {
    width: 100%;
    height: calc(100% - 53px); /* 100% minus header height roughly */
    border: none;
    background: #fff;
    display: block;
}

/* Responsive Grid Adjustments */
@media (max-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }
    .templates-container {
        padding: 100px 20px 20px;
    }
}

/* Navbar */
.custom-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10000;
    background: rgba(4, 13, 12, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.nav-logo img {
    height: 54px;
    width: auto;
}

.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links li a {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: #fff;
    text-decoration: none;
    position: relative;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.nav-links li a::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 0%;
    height: 2px;
    background-color: #b5de00;
    transition: width 0.3s ease;
}

.nav-links li a:hover::after {
    width: 100%;
}

@media (max-width: 1024px) {
    .custom-nav {
        padding: 15px 30px;
    }
}

/* ========================================
   NEW PRELOADER STYLES
   ======================================== */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(1, 1, 1, 0.99);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.8s cubic-bezier(0.77, 0, 0.175, 1),
    visibility 0.8s cubic-bezier(0.77, 0, 0.175, 1);
}

#preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(181, 222, 0, 0.15) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 1.5s ease;
  pointer-events: none;
}

#preloader.loaded .preloader-background {
  opacity: 1;
}

.preloader-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8vw;
  z-index: 2;
  position: relative;
  max-width: 1200px;
  width: 90%;
}

.preloader-character {
  position: relative;
  width: 40vw;
  max-width: 500px;
  height: 60vh;
  max-height: 600px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.preloader-char-img {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 100%;
  width: auto;
  opacity: 0;
  transition: opacity 0.5s ease;
  filter: drop-shadow(0 0 30px rgba(181, 222, 0, 0.3));
  display: none;
}

html[data-character="male"] .preloader-char-img[data-gender="male"],
html[data-character="female"] .preloader-char-img[data-gender="female"] {
  opacity: 1;
  display: block;
}

.preloader-char-img.active {
  opacity: 1;
  display: block;
}

.preloader-char-img:not(.active) {
  display: none;
}

.preloader-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.preloader-brand {
  font-family: 'Poppins', sans-serif;
  font-weight: 900;
  font-size: 2rem;
  color: var(--text, #e7e7e0);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 10px;
  opacity: 0;
  animation: fadeInBrand 1.5s ease forwards 0.5s;
  text-shadow: 0 0 15px rgba(181, 222, 0, 0.2);
}

@keyframes fadeInBrand {
  to {
    opacity: 1;
  }
}

.circular-progress {
  position: relative;
  width: 120px;
  height: 120px;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring__circle-bg {
  transition: stroke-dasharray 0.3s ease;
}

.progress-ring__circle {
  transition: stroke-dasharray 0.5s cubic-bezier(0.77, 0, 0.175, 1);
  stroke-dasharray: 339.292;
  stroke-dashoffset: 339.292;
}

.percentage-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Poppins', sans-serif;
  font-weight: 900;
  font-size: 1.8rem;
  color: var(--grass, #b5de00);
  letter-spacing: 2px;
}

.loading-text {
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 3px;
  text-transform: uppercase;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

@media (max-width: 1024px) {
  .preloader-container {
    gap: 4vw;
  }
  .preloader-character {
    width: 45vw;
    height: 50vh;
  }
}

@media (max-width: 768px) {
  .preloader-container {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    height: 100vh;
    width: 100%;
    max-width: 100%;
  }

  .preloader-character {
    width: 75vw;
    height: 38vh;
    max-height: 320px;
    order: 1;
    margin-bottom: 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
  }

  .preloader-char-img {
    height: 100%;
    width: auto;
  }

  .preloader-info {
    order: 2;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .circular-progress {
    width: 110px;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .progress-ring {
    width: 110px;
    height: 110px;
  }

  .progress-ring__circle,
  .progress-ring__circle-bg {
    r: 48;
    cx: 55;
    cy: 55;
  }

  .preloader-brand {
    font-size: 1.5rem;
    letter-spacing: 3px;
    margin-bottom: 5px;
  }

  .percentage-text {
    font-size: 1.5rem;
    width: 100%;
    text-align: center;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
  }

  .loading-text {
    font-size: 0.7rem;
    margin-top: 15px;
    width: 90%;
    text-align: center;
    white-space: nowrap;
    letter-spacing: 2px;
  }
}

@media (max-width: 480px) {
  .preloader-character {
    width: 80vw;
    height: 35vh;
  }
  .preloader-container {
    gap: 10px;
  }
}

body.loading {
  overflow: hidden;
}

/* ========================================
   CONTACT PANEL STYLES
   ======================================== */
.contact-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10005;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.contact-overlay.active {
    opacity: 1;
    visibility: visible;
}

.contact-panel {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    max-width: 100%;
    height: 100vh;
    background: rgba(4, 13, 12, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10010;
    padding: 100px 40px 40px 40px;
    display: flex;
    flex-direction: column;
    transition: right 0.5s cubic-bezier(0.77, 0, 0.175, 1);
    overflow-y: auto;
    color: #fff;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}

.contact-panel.open {
    right: 0;
}

.panel-close-btn {
    position: absolute;
    top: 25px;
    right: 30px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
}

.panel-close-btn:hover {
    color: #b5de00;
    transform: rotate(90deg);
}

.panel-heading {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
}

.panel-subheading {
    font-size: 14px;
    opacity: 0.7;
    margin-bottom: 30px;
}

#contactForm {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.minimal-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px 20px;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s ease;
}

.minimal-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.minimal-input:focus {
    outline: none;
    border-bottom-color: #b5de00;
    background: rgba(255, 255, 255, 0.1);
}

.minimal-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

select.minimal-input option {
    background: #040d0c;
    color: #fff;
}

.btn-send-oval {
    margin-top: 15px;
    padding: 16px;
    background: #b5de00;
    color: #040d0c;
    border: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-send-oval:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(181, 222, 0, 0.2);
}

.btn-send-oval:active {
    transform: translateY(0);
}

/* Custom Select Dropdowns */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.custom-select-trigger svg {
    transition: transform 0.3s ease;
    opacity: 0.5;
}

.custom-select-wrapper.open .custom-select-trigger svg {
    transform: rotate(180deg);
}

.custom-select-trigger.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.05) !important;
    border-bottom-color: rgba(255, 255, 255, 0.2) !important;
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #040d0c;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 10;
    display: none;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.custom-select-wrapper.open .custom-select-options {
    display: block;
    animation: fadeInDropdown 0.2s ease forwards;
}

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

.custom-option {
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    color: rgba(255, 255, 255, 0.8);
}

.custom-option:hover {
    background: #b5de00;
    color: #040d0c;
    font-weight: 500;
}

.custom-option.selected {
    background: rgba(181, 222, 0, 0.1);
    color: #b5de00;
}

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

::-webkit-scrollbar-track {
    background: #040d0c;
}

::-webkit-scrollbar-thumb {
    background: #b5de00;
    border-radius: 10px;
    border: 2px solid #040d0c;
}

::-webkit-scrollbar-thumb:hover {
    background: #c3eb14;
}

* {
    scrollbar-width: thin;
    scrollbar-color: #b5de00 #040d0c;
}
