/**
 * ============================================
 * TENUTA RE DI ROMA - CUSTOM STYLES
 * ============================================
 * 
 * Estructura:
 * 1. Variables y configuración base
 * 2. Tipografía y utilidades
 * 3. Navbar y navegación
 * 4. Hero Carousel
 * 5. Chat Widget
 * 6. Responsive / Media Queries
 * 
 * Author: Tined Solutions
 * Version: 1.0.0
 */

/* ============================================
   1. VARIABLES Y CONFIGURACIÓN BASE
   ============================================ */

:root {
    --color-primary: #546a2f;
    --color-background-light: #f7f7f6;
    --color-background-dark: #1a1d15;
    --color-metro-orange: #ea580c;
    
    --transition-smooth: cubic-bezier(0.23, 1, 0.32, 1);
    --transition-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   2. TIPOGRAFÍA Y UTILIDADES
   ============================================ */

.serif-title {
    font-family: 'Playfair Display', 'Noto Serif', serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

body {
    min-height: max(884px, 100dvh);
}

/* ============================================
   3. NAVBAR Y NAVEGACIÓN
   ============================================ */

/* Premium Navbar Custom Styles */
.nav-link {
    position: relative;
    transition: all 0.3s ease;
}

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

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

/* Dropdown Menu Styles */
.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu {
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.1), 
                0 10px 15px -5px rgba(0, 0, 0, 0.05);
}

/* Mobile Menu Styles */
.mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.mobile-menu.open {
    max-height: 1000px;
    transition: max-height 0.5s ease-in;
}

.mobile-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    opacity: 0;
}

.mobile-submenu.open {
    max-height: 320px;
    opacity: 1;
}

.mobile-submenu-toggle .submenu-icon {
    transition: transform 0.3s ease;
}

.mobile-submenu-toggle[aria-expanded="true"] .submenu-icon {
    transform: rotate(180deg);
}

/* ============================================
   4. HERO CAROUSEL
   ============================================ */

.carousel-container {
    perspective: 1000px;
    touch-action: pan-y pinch-zoom;
}

.carousel-track {
    transform-style: preserve-3d;
    transition: transform 0.5s var(--transition-smooth);
}

.carousel-item {
    backface-visibility: hidden;
    transition: all 0.5s var(--transition-smooth);
}

.carousel-item.active {
    opacity: 1;
    transform: scale(1) translateZ(0);
}

.carousel-item.hidden {
    opacity: 0;
    transform: scale(0.8) translateZ(-200px);
}

/* Hero Navigation Buttons */
.hero-nav-btn {
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.hero-nav-btn:active {
    transform: scale(0.95);
}

/* Progress Bar */
.progress-bar {
    transition: width 0.5s var(--transition-smooth);
}

/* ============================================
   5. CHAT WIDGET
   ============================================ */

#chat-widget-window {
    width: 380px;
    height: 560px;
    border-radius: 16px;
    box-shadow: 0 12px 40px -4px rgba(0, 0, 0, 0.22), 
                0 4px 16px -2px rgba(0, 0, 0, 0.12);
    transform-origin: bottom right;
    transform: scale(0.85) translateY(16px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s var(--transition-bounce), 
                opacity 0.22s ease;
    overflow: hidden;
}

#chat-widget-window.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

#chat-fab {
    pointer-events: auto;
    box-shadow: 0 4px 20px rgba(84, 106, 47, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#chat-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(84, 106, 47, 0.55);
}

#chat-fab:active {
    transform: scale(0.95);
}

/* ============================================
   6. RESPONSIVE / MEDIA QUERIES
   ============================================ */

/* --- Mobile (max-width: 640px) --- */
@media (max-width: 640px) {
    .carousel-item.prev {
        opacity: 0;
        transform: scale(0.8) translateX(-50%) translateZ(-100px);
    }
    
    .carousel-item.next {
        opacity: 0;
        transform: scale(0.8) translateX(50%) translateZ(-100px);
    }
}

/* --- Tablet and above (min-width: 641px) --- */
@media (min-width: 641px) {
    .carousel-item.prev {
        opacity: 0.7;
        transform: scale(0.9) translateX(-100%) translateZ(-100px);
    }
    
    .carousel-item.next {
        opacity: 0.7;
        transform: scale(0.9) translateX(100%) translateZ(-100px);
    }
}

/* --- Hover capable devices --- */
@media (hover: hover) {
    .hero-nav-btn:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: scale(1.1);
    }
}

/* --- Desktop (min-width: 1024px) --- */
@media (min-width: 1024px) {
    #chat-fab {
        display: none !important;
    }
    
    #chat-widget {
        bottom: auto !important;
        top: 80px;
    }
    
    #chat-widget-window {
        width: 520px;
        height: calc(100dvh - 96px);
        transform-origin: top right;
        transform: scale(0.85) translateY(-16px);
    }
    
    #chat-widget-window.open {
        transform: scale(1) translateY(0);
    }
}

/* --- Mobile Chat Widget (max-width: 480px) --- */
@media (max-width: 480px) {
    #chat-widget-window {
        width: calc(100vw - 24px);
        height: 75dvh;
        border-radius: 16px;
    }
}

/* ============================================
   7. LANGUAGE SWITCHER
   ============================================ */

/* Container - Dropdown trigger button */
.lang-switcher {
    position: relative;
}

.lang-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: transparent;
    border: 1.5px solid rgba(100, 116, 139, 0.25);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s var(--transition-smooth);
    font-family: inherit;
}

.lang-trigger:hover {
    border-color: var(--color-primary);
    background: rgba(84, 106, 47, 0.05);
}

.lang-trigger .lang-flag {
    font-size: 18px;
    line-height: 1;
}

.lang-trigger .lang-code {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lang-trigger .lang-arrow {
    font-size: 18px;
    color: #64748b;
    transition: transform 0.3s var(--transition-smooth);
}

.lang-switcher.open .lang-trigger {
    border-color: var(--color-primary);
    background: rgba(84, 106, 47, 0.08);
}

.lang-switcher.open .lang-trigger .lang-arrow {
    transform: rotate(180deg);
}

/* Dropdown panel */
.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 160px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.15),
                0 4px 12px -2px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(100, 116, 139, 0.1);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transform-origin: top right;
    transition: all 0.25s var(--transition-bounce);
    z-index: 100;
}

.lang-switcher.open .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Dropdown options */
.lang-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.lang-option:hover {
    background: rgba(84, 106, 47, 0.08);
    color: var(--color-primary);
}

.lang-option.active {
    background: linear-gradient(135deg, var(--color-primary) 0%, #3d4f22 100%);
    color: white;
    font-weight: 600;
}

.lang-option.active::after {
    content: '';
    position: absolute;
    right: 14px;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.lang-option .lang-flag {
    font-size: 20px;
    line-height: 1;
}

.lang-option .lang-name {
    flex: 1;
}

/* Dark mode */
.dark .lang-trigger {
    border-color: rgba(255, 255, 255, 0.15);
}

.dark .lang-trigger:hover {
    border-color: var(--color-primary);
    background: rgba(84, 106, 47, 0.15);
}

.dark .lang-trigger .lang-code {
    color: #e2e8f0;
}

.dark .lang-trigger .lang-arrow {
    color: #94a3b8;
}

.dark .lang-dropdown {
    background: #22251d;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.4);
}

.dark .lang-option {
    color: #e2e8f0;
}

.dark .lang-option:hover {
    background: rgba(84, 106, 47, 0.2);
    color: #a3c45a;
}

/* Mobile Language Switcher in Menu */
.lang-switcher-mobile {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 20px;
    border-top: 1px solid rgba(100, 116, 139, 0.1);
    background: linear-gradient(180deg, rgba(84, 106, 47, 0.02) 0%, transparent 100%);
}

.lang-switcher-mobile .lang-label {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
    padding-left: 4px;
}

.lang-option-mobile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    color: #475569;
    background: white;
    border-radius: 12px;
    border: 1.5px solid transparent;
    transition: all 0.25s var(--transition-smooth);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.lang-option-mobile:hover {
    border-color: rgba(84, 106, 47, 0.3);
    transform: translateX(4px);
}

.lang-option-mobile.active {
    background: linear-gradient(135deg, var(--color-primary) 0%, #3d4f22 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(84, 106, 47, 0.25);
}

.lang-option-mobile .lang-flag {
    font-size: 22px;
}

.lang-option-mobile .lang-name {
    flex: 1;
}

.lang-option-mobile .lang-check {
    font-size: 20px;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s var(--transition-bounce);
}

.lang-option-mobile.active .lang-check {
    opacity: 1;
    transform: scale(1);
}

/* Dark mode mobile */
.dark .lang-switcher-mobile {
    border-color: rgba(255, 255, 255, 0.05);
}

.dark .lang-option-mobile:not(.active) {
    background: rgba(255, 255, 255, 0.03);
    color: #e2e8f0;
}

.dark .lang-option-mobile:hover:not(.active) {
    background: rgba(255, 255, 255, 0.08);
}
