/**
 * Custom CSS for The Candle Dux
 * Tailwind extensions and custom styles
 */

:root {
    --primary-gold: #d4af37;
    --dark: #1a1a1a;
    --light: #f5f5f5;
}

/* Utility helpers for navigation and layout */
.header-link {
    position: relative;
    color: #4b5563;
    font-weight: 500;
    padding-bottom: 0.25rem;
    transition: color 0.2s ease;
}

.header-link:hover,
.header-link:focus {
    color: #b45309;
}

.header-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background: var(--primary-gold);
    transition: width 0.2s ease;
}

.header-link:hover::after,
.header-link:focus::after {
    width: 100%;
}

.header-link:focus-visible {
    outline: 2px solid var(--primary-gold);
    outline-offset: 3px;
}

.mobile-menu {
    display: none;
    box-shadow: 0 24px 48px rgba(17, 17, 17, 0.25);
    border-radius: 0 0 1.25rem 1.25rem;
    transform-origin: top;
}

.mobile-menu.active {
    display: block;
    animation: mobileMenuSlide 0.25s ease forwards;
}

@keyframes mobileMenuSlide {
    from {
        opacity: 0;
        transform: translateY(-0.5rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-link {
    display: block;
    background: #f9fafb;
    color: #374151;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.mobile-link:hover,
.mobile-link:focus {
    background: rgba(217, 119, 6, 0.1);
    color: #b45309;
}

.mobile-link:focus-visible {
    outline: 2px solid var(--primary-gold);
    outline-offset: 2px;
}

.mobile-link-button {
    display: inline-flex;
    width: 100%;
    justify-content: center;
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    color: white;
    padding: 0.85rem;
    border-radius: 0.75rem;
    font-weight: 700;
    box-shadow: 0 12px 32px rgba(217, 119, 6, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mobile-link-button:hover,
.mobile-link-button:focus {
    transform: translateY(-2px);
    box-shadow: 0 18px 38px rgba(217, 119, 6, 0.35);
}

.mobile-menu-open {
    overflow: hidden;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Smooth transitions */
* {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.footer-link:hover,
.footer-link:focus,
.mobile-link:hover,
.mobile-link:focus,
.header-link:hover,
.header-link:focus {
    text-decoration: none;
}

/* Hero Section */
.hero {
    position: relative;
    overflow: hidden;
}

.hero-swiper,
.hero-slide {
    min-height: clamp(360px, 50vw, 520px);
}

.hero-slide {
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 26, 0.7);
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: white;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #d4af37 0%, #e8c547 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.5rem;
    color: #ccc;
    margin-bottom: 2rem;
}

.hero .swiper-button-prev,
.hero .swiper-button-next {
    color: white;
}

.hero .swiper-pagination-bullet {
    background: rgba(255, 255, 255, 0.5);
}

.hero .swiper-pagination-bullet-active {
    background: #d4af37;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Product Cards */
.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.product-card-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background: #f0f0f0;
}

.product-card-body {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
}

.product-card-desc {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.product-card-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #d4af37;
    margin-bottom: 1rem;
}

.product-card-footer {
    display: flex;
    gap: 1rem;
    margin-top: auto;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, #d4af37 0%, #e8c547 100%);
    color: #1a1a1a;
}

.btn-primary:hover {
    box-shadow: 0 8px 16px rgba(212, 175, 55, 0.3);
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    color: #d4af37;
    border-color: #d4af37;
}

.btn-secondary:hover {
    background: #d4af37;
    color: #1a1a1a;
}

.btn-outline {
    background: transparent;
    color: white;
    border-color: white;
}

.btn-outline:hover {
    background: white;
    color: #1a1a1a;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: min(500px, 100%);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 2rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-primary {
    background: #d4af37;
    color: #1a1a1a;
}

.badge-secondary {
    background: #f0f0f0;
    color: #1a1a1a;
}

.badge-success {
    background: #10b981;
    color: white;
}

.badge-danger {
    background: #ef4444;
    color: white;
}

/* Section spacing */
.section {
    padding: 4rem 0;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: #1a1a1a;
}

.section-subtitle {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 3rem;
}

/* Footer utilities */
.footer-heading {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fbbf24;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.footer-link-list {
    display: grid;
    gap: 0.75rem;
}

.footer-link {
    color: #d1d5db;
    font-size: 0.95rem;
    transition: color 0.2s ease, transform 0.2s ease;
}

.footer-link:hover,
.footer-link:focus {
    color: #fbbf24;
    transform: translateX(4px);
}

.footer-link:focus-visible {
    outline: 2px solid var(--primary-gold);
    outline-offset: 3px;
}

.footer-contact {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
    align-items: flex-start;
}

.footer-contact-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.footer-social {
    width: 2.75rem;
    height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(251, 191, 36, 0.15);
    color: #fcd34d;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.footer-social:hover,
.footer-social:focus {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1f2937;
    transform: translateY(-3px) scale(1.05);
}

.footer-social:focus-visible {
    outline: 2px solid var(--primary-gold);
    outline-offset: 3px;
}

/* Grid layouts */
.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

/* Swiper adjustments */
.hero-swiper .swiper-button-prev,
.hero-swiper .swiper-button-next,
.collections-swiper .swiper-button-prev,
.collections-swiper .swiper-button-next,
.products-swiper .swiper-button-prev,
.products-swiper .swiper-button-next {
    color: #d4af37;
}

.collections-swiper .swiper-pagination-bullet,
.products-swiper .swiper-pagination-bullet {
    background: rgba(212, 175, 55, 0.4);
}

.collections-swiper .swiper-pagination-bullet-active,
.products-swiper .swiper-pagination-bullet-active {
    background: #d4af37;
}

.collections-swiper .swiper-slide,
.products-swiper .swiper-slide {
    display: flex;
    height: auto;
}

.collections-swiper .product-card,
.products-swiper .product-card {
    width: 100%;
}

@media (max-width: 1024px) {
    .hero h1 {
        font-size: clamp(2rem, 5vw, 3rem);
    }

    .hero p {
        font-size: clamp(1rem, 3.5vw, 1.35rem);
    }

    .product-card-image {
        height: clamp(220px, 40vw, 280px);
    }
}

@media (max-width: 768px) {
    .grid-auto {
        grid-template-columns: 1fr;
    }
    
    .hero h1 {
        font-size: 1.8rem;
    }

    .hero p {
        font-size: 1.1rem;
    }

    .product-card {
        border-radius: 16px;
    }

    .mobile-link-button {
        font-size: 1rem;
    }
}

@media (max-width: 640px) {
    .hero-slide {
        align-items: flex-end;
        padding-bottom: 3rem;
    }

    .hero .btn {
        width: 100%;
        justify-content: center;
    }

    .product-card-body {
        padding: 1.25rem;
    }

    .product-card-footer {
        flex-direction: column;
    }

    .product-card-footer .btn {
        width: 100%;
        text-align: center;
    }

    .modal-content {
        width: 95%;
        max-width: 420px;
        border-radius: 1.25rem;
    }

    .modal-body {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .hero-swiper,
    .hero-slide {
        min-height: 320px;
    }

    .hero h1 {
        font-size: 1.6rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .hero .btn {
        padding: 0.75rem 1rem;
    }

    .product-card-image {
        height: clamp(200px, 55vw, 260px);
    }

    .section {
        padding: 3rem 0;
    }

    .section-title {
        font-size: 2rem;
    }
}

/* Image Gallery */
.image-gallery {
    display: grid;
    grid-template-columns: 1fr 4fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.gallery-thumbnails {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.product-thumbnail {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.product-thumbnail:hover {
    border-color: #d4af37;
}

.product-thumbnail.active {
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

#mainProductImage {
    width: 100%;
    height: auto;
    border-radius: 12px;
    object-fit: cover;
}

@media (max-width: 768px) {
    .image-gallery {
        grid-template-columns: 1fr;
    }
    
    .gallery-thumbnails {
        flex-direction: row;
        overflow-x: auto;
    }
}

/* Loading spinner */
.spinner {
    border: 4px solid #f0f0f0;
    border-top: 4px solid #d4af37;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utilities */
.text-primary {
    color: #d4af37;
}

.text-dark {
    color: #1a1a1a;
}

.bg-primary {
    background: #d4af37;
}

.bg-dark {
    background: #1a1a1a;
}

.shadow-lg {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Responsive utilities */
.hidden-mobile {
    display: none;
}

@media (min-width: 768px) {
    .hidden-mobile {
        display: block;
    }
}

.hidden-desktop {
    display: block;
}

@media (min-width: 768px) {
    .hidden-desktop {
        display: none;
    }
}