/* Custom Styles for Cartas para la Vida */

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #738AC5;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #678ABE;
}

/* Navigation Styles */
#navbar {
    transition: all 0.3s ease;
}

#navbar.scrolled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    background-color: rgba(255, 255, 255, 0.98);
}

.nav-link {
    position: relative;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 50%;
    background-color: #678ABE;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 100%;
}

/* Hero Section Animations */
@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.gradient-animate {
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
}

/* Parallax Effect for Hero */
.parallax {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Fade In Animation for Sections */
.fade-in-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Testimonial Slider */
.testimonial-container {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
}

.testimonial-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.testimonial-slide {
    flex: 0 0 100%;
    padding: 0 1rem;
}

.testimonial-indicator {
    cursor: pointer;
    transition: all 0.3s ease;
}

.testimonial-indicator.active {
    background-color: #3262A8;
    width: 2rem;
}

/* Book Cover Hover Effects */
.book-shadow {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.book-shadow:hover {
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
    transform: translateY(-5px) scale(1.02);
}

/* CTA Buttons Animation */
.cta-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(103, 138, 190, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(103, 138, 190, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(103, 138, 190, 0);
    }
}

/* Letter Images Hover Effect */
.letter-hover {
    position: relative;
    overflow: hidden;
}

.letter-hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.letter-hover:hover::before {
    left: 100%;
}

/* Loading Animation */
.loader {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #678ABE;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Menu Animation */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

#mobile-menu.show {
    max-height: 500px;
    transition: max-height 0.3s ease-in;
}

/* Back to Top Button */
#back-to-top {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#back-to-top.show {
    opacity: 1;
    visibility: visible;
}

#back-to-top:hover {
    transform: translateY(-5px);
}

/* Image Gallery Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* Responsive Typography */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.5rem;
    }
}

/* Print Styles */
@media print {
    #navbar,
    #back-to-top,
    .nav-link,
    button {
        display: none !important;
    }

    body {
        font-size: 12pt;
    }

    section {
        page-break-inside: avoid;
    }
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Styles for Keyboard Navigation */
a:focus,
button:focus {
    outline: 2px solid #678ABE;
    outline-offset: 2px;
}

/* Skip to Content Link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #678ABE;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* Custom Selection Colors */
::selection {
    background-color: #738AC5;
    color: white;
}

::-moz-selection {
    background-color: #738AC5;
    color: white;
}

/* Loading Skeleton Animation */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Testimonial Quote Style */
.quote-mark {
    font-size: 4rem;
    color: #738AC5;
    opacity: 0.3;
    position: absolute;
    top: -20px;
    left: -10px;
}

/* Card Hover Effects */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Smooth Transitions for All Interactive Elements */
button,
a,
input,
textarea {
    transition: all 0.3s ease;
}

/* Instagram Feed Container */
.instagram-feed-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 0;
}

.instagram-feed-container h3 {
    font-family: 'Caveat', cursive;
    letter-spacing: 0.5px;
}

/* Curator.io Feed Customization */
#curator-feed-default-feed-layout {
    background: transparent;
    border-radius: 12px;
    padding: 1rem;
}

/* Override Curator.io default styles to match brand colors */
.crt-widget {
    background-color: transparent !important;
}

.crt-post {
    border-radius: 8px !important;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.crt-post:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(115, 138, 197, 0.3);
}

.crt-logo {
    opacity: 0.5;
    font-size: 0.75rem;
    margin-top: 1rem;
}

/* Purchase Button Special Styling */
#contacto .inline-block[href*="mitiendanube"] {
    position: relative;
    overflow: hidden;
}

#contacto .inline-block[href*="mitiendanube"]::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

#contacto .inline-block[href*="mitiendanube"]:hover::before {
    width: 300px;
    height: 300px;
}

/* Responsive adjustments for Instagram feed */
@media (max-width: 768px) {
    .instagram-feed-container {
        padding: 1rem 0;
    }

    #curator-feed-default-feed-layout {
        padding: 0.5rem;
    }
}

/* Contact Section Button Hierarchy */
#contacto a[href*="mitiendanube"] {
    box-shadow: 0 8px 25px rgba(115, 138, 197, 0.4);
}

#contacto a[href*="mitiendanube"]:hover {
    box-shadow: 0 12px 35px rgba(115, 138, 197, 0.6);
}

/* Contact Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal-overlay.show {
    opacity: 1;
}

.modal-container {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-container {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1F3F6B;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background-color: #f3f4f6;
    color: #1F3F6B;
}

.modal-body {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.form-input:focus {
    outline: none;
    border-color: #678ABE;
    box-shadow: 0 0 0 3px rgba(103, 138, 190, 0.1);
}

.form-input::placeholder {
    color: #9ca3af;
}

textarea.form-input {
    resize: vertical;
    min-height: 120px;
}

.form-status {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.form-status.success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.form-status.error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
}

.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: #3262A8;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #1F3F6B;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(50, 98, 168, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header {
        padding: 1rem 1.5rem;
    }

    .modal-title {
        font-size: 1.25rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .modal-footer {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}