@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=DM+Serif+Display:ital@0;1&display=swap');

:root {
    --primary: #2D1B69;
    --primary-mid: #6B46C1;
    --primary-light: #EDE9FE;
    --accent: #F59E0B;
    --green-wa: #25D366;
    --text-dark: #1A1A2E;
    --text-mid: #4A5568;
    --white: #FFFFFF;
    --gray-light: #F7FAFC;
    --shimmer: linear-gradient(90deg, #F0F0F0 25%, #E0E0E0 50%, #F0F0F0 75%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'DM Sans', sans-serif;
    color: var(--text-dark);
    background-color: var(--gray-light);
    overflow: hidden;
    /* Handled by panels */
    height: 100dvh;
    width: 100vw;
}

/* Layout Shell */
.app-container {
    display: flex;
    height: 100dvh;
    width: 100vw;
    position: relative;
}

/* --- CHAT PANEL --- */
.chat-panel {
    width: 420px;
    min-width: 420px;
    /* prevents flex from squishing it */
    height: 100%;
    background: var(--white);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1000;
    overflow: hidden;
    /* needed for smooth width collapse */
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        min-width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed: width shrinks to zero, preview panel expands naturally */
.chat-panel.collapsed {
    width: 0;
    min-width: 0;
}

/* Fixed-position toggle button — always visible, independent of chat transforms */
.chat-toggle-btn {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 64px;
    /* Default width when collapsed (holds both icons) */
    height: 64px;
    background: var(--primary);
    border-radius: 0 14px 14px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    color: var(--white);
    z-index: 2000;
    box-shadow: 4px 0 20px rgba(45, 27, 105, 0.35);
    transition: background 0.2s, transform 0.2s, width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    outline: none;
    padding-left: 4px;
    overflow: hidden;
}

.chat-toggle-btn:hover {
    background: var(--primary-mid);
    transform: translateY(-50%) translateX(3px);
}

.chat-toggle-btn .toggle-icon {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.chat-toggle-btn .cart-icon {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        margin 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    width: 18px;
    flex-shrink: 0;
}

/* When chat is OPEN, shrink the button and hide cart */
.chat-toggle-btn.is-open {
    width: 36px;
}

.chat-toggle-btn.is-open .cart-icon {
    opacity: 0;
    width: 0;
    margin: 0;
    /* Removing any gap effect */
}

/* When chat is open, chevron points left (←) */
.chat-toggle-btn.is-open .toggle-icon {
    transform: rotate(180deg);
}

/* Preview panel expands automatically when chat shrinks (no extra class needed) */
.preview-panel {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    background: #F0F2F5;
    position: relative;
    scrollbar-width: thin;
}

.chat-header {
    padding: 16px 15px;
    /* Slightly less padding to fit elements */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Use gap and margin-left:auto */
    gap: 12px;
    cursor: pointer;
    overflow: hidden;
}

/* State Indicators (Left) */
.state-indicator {
    display: flex;
    gap: 8px;
    align-items: center;
}

.state-icon {
    color: var(--text-mid);
    opacity: 0.3;
    transition: all 0.3s ease;
}

/* Active Icon States */
.chat-panel:not(.medium):not(.maximized) .state-icon.minimize,
.chat-panel.medium .state-icon.medium,
.chat-panel.maximized .state-icon.maximize {
    color: var(--primary);
    opacity: 1;
    transform: scale(1.1);
}

/* Pulsing effect for medium icon when minimized */
.chat-panel:not(.medium):not(.maximized) .state-icon.medium {
    animation: indicatorPulse 1.5s infinite ease-in-out;
}

@keyframes indicatorPulse {
    0% {
        opacity: 0.3;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.2);
        color: var(--primary);
    }

    100% {
        opacity: 0.3;
        transform: scale(1);
    }
}

.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo img {
    height: 32px;
}

/* Progress & Percentage (Right) */
.progress-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    justify-content: flex-end;
    background: var(--primary-light);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(45, 27, 105, 0.1);
}

.progress-container {
    height: 6px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    overflow: hidden;
    width: 80px;
    flex-shrink: 0;
}

.chat-header .progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0;
    transition: width 0.5s cubic-bezier(0.1, 0.7, 0.1, 1);
}

.percentage-label {
    font-size: 14px;
    font-weight: 900;
    color: var(--primary);
    min-width: 45px;
    text-align: right;
    white-space: nowrap;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}

.message.ai {
    background: var(--primary-light);
    color: var(--primary);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.message.user {
    background: var(--primary);
    color: var(--white);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-input-area {
    padding: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-container {
    display: flex;
    gap: 10px;
}

input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    font-family: inherit;
    outline: none;
}

input[type="text"]:focus {
    border-color: var(--primary-mid);
}

.send-btn {
    background: var(--primary);
    color: var(--white);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.option-btn {
    padding: 10px;
    border: 1px solid var(--primary-mid);
    background: var(--white);
    color: var(--primary-mid);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.option-btn:hover {
    background: var(--primary-light);
}

.option-btn.selected {
    background: var(--primary-mid);
    color: var(--white);
}

/* --- PREVIEW PANEL --- */
.preview-panel {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    background: #F0F2F5;
    position: relative;
    scrollbar-width: thin;
}

.site-container {
    max-width: 100%;
    min-height: 100%;
    background: #1A1042;
    /* Darker background to match hero and fix gaps */
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

/* Preview Navigation */
.preview-nav {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* links centered */
    background: #0F092A;
    position: sticky;
    top: 0;
    z-index: 5000;
    border-bottom: 2px solid var(--accent);
}

.nav-logo {
    font-size: 13px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 1;
    /* compress logo before clipping links */
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: nowrap;
    flex-shrink: 0;
    /* links never compress */
}

.nav-links a {
    text-decoration: none;
    color: #FFFFFF !important;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--accent) !important;
}

section {
    padding: 60px 20px;
    position: relative;
}

/* Non-hero sections sit on a light bg so text is readable */
#services,
#gallery,
#contact {
    background: var(--white);
    color: var(--text-dark);
}

#services .section-title,
#gallery .section-title {
    color: var(--primary);
}

.hero {
    height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: linear-gradient(rgba(45, 27, 105, 0.7), rgba(45, 27, 105, 0.7)), url('assets/salon.png');
    background-size: cover;
    background-position: center;
    color: var(--white);
}

.hero h1 {
    font-family: 'DM Serif Display', serif;
    font-size: 48px;
    margin-bottom: 16px;
    line-height: 1.1;
}

.hero p {
    font-size: 18px;
    opacity: 0.9;
    max-width: 500px;
}

.shimmer-text {
    height: 20px;
    background: var(--shimmer);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    display: inline-block;
}

.hero .cta-btn {
    margin-top: 32px;
    background: var(--accent);
    color: var(--text-dark);
    padding: 16px 32px;
    border-radius: 50px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.service-card {
    padding: 24px;
    background: var(--white);
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    color: var(--text-dark);
    transition: transform 0.3s, box-shadow 0.3s;
}

.service-card h3 {
    color: var(--primary);
    margin-bottom: 8px;
}

.service-card p {
    color: var(--text-mid);
    font-size: 14px;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(45, 27, 105, 0.1);
    border-color: var(--primary-mid);
}

.section-title {
    font-family: 'DM Serif Display', serif;
    font-size: 32px;
    text-align: center;
    margin-bottom: 40px;
    color: var(--primary);
}

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.photo-placeholder {
    aspect-ratio: 1/1;
    background: #F0F2F5;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #CBD5E0;
    color: #A0AEC0;
}

.photo-placeholder svg {
    width: 32px;
    height: 32px;
}

.photo-item {
    aspect-ratio: 1/1;
    border-radius: 8px;
    overflow: hidden;
    object-fit: cover;
}

/* Mobile Adjustments (Drawer) */
@media (max-width: 1023px) {
    .chat-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100vw;
        min-width: 100vw;
        box-sizing: border-box;
        /* Crucial: stops padding/borders from expanding beyond 100vw */
        height: 88px;
        /* Peek state by default */
        transform: none;
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.1);
        padding-bottom: env(safe-area-inset-bottom, 20px);
        transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .chat-header {
        cursor: pointer;
    }

    .chat-panel.medium {
        height: 52dvh;
        transform: none;
    }

    .chat-panel.maximized {
        height: 92dvh;
        transform: none;
    }

    .handle {
        width: 100%;
        height: 44px;
        /* Much larger hit area for touch */
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: var(--text-mid);
        opacity: 0.6;
        transition: opacity 0.2s;
    }

    .handle:active {
        opacity: 1;
    }

    .handle svg {
        transition: transform 0.3s ease;
    }

    /* When maximized, chevron points DOWN to indicate collapse */
    .chat-panel.maximized .handle svg {
        transform: rotate(180deg);
    }

    .preview-panel {
        padding-bottom: 88px;
    }

    /* Fix header overflow on mobile: hide state indicators, reduce progress bar width */
    .chat-header .state-indicator {
        display: none;
    }

    .progress-container {
        width: 60px;
    }

    .chat-header {
        padding: 12px;
    }

    /* Input area adjustments to prevent send button clipping */
    .chat-input-area {
        padding: 12px;
    }

    .input-wrapper {
        padding-right: 48px;
        /* Ensure button doesn't overlap text */
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    from {
        background-position: -200% 0;
    }

    to {
        background-position: 200% 0;
    }
}

@keyframes pulse-border {
    0% {
        outline: 4px solid rgba(107, 70, 193, 0);
        outline-offset: 0;
    }

    50% {
        outline: 4px solid rgba(107, 70, 193, 0.5);
        outline-offset: 4px;
    }

    100% {
        outline: 4px solid rgba(107, 70, 193, 0);
        outline-offset: 0;
    }
}

.highlight-section {
    animation: pulse-border 1.5s infinite ease-in-out;
    position: relative;
    z-index: 10;
}

.guide-label {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--primary);
    color: var(--white);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 100;
    pointer-events: none;
    animation: fadeIn 0.3s ease;
}

.guide-label::before {
    content: "✦";
    color: var(--accent);
}

/* Hint Box - position:fixed so it is never clipped by parent overflow */
.hint-box {
    position: fixed;
    width: 300px;
    background: rgba(45, 27, 105, 0.98);
    backdrop-filter: blur(15px);
    border-bottom: 4px solid var(--accent);
    color: var(--white);
    padding: 20px 24px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.6;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 20px rgba(245, 158, 11, 0.1);
    z-index: 800;
    /* below chat panel (1000) so it never covers it */
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    text-align: center;
    animation: hintFadeSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes hintSlideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -110%) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -100%) scale(1);
    }
}

@keyframes hintZoomIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.hint-target {
    position: relative;
}

.hint-box-title {
    font-weight: bold;
    color: var(--accent);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Centered title */
    gap: 8px;
}

.hint-box-text {
    opacity: 0.95;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Adjust sections to have enough space for hint boxes at the top */
section.highlight-section {
    margin-top: 80px;
    /* Add margin to prevent overlap with previous sections */
    transition: margin 0.3s ease;
}

/* WhatsApp Widget */
.whatsapp-widget {
    position: fixed;
    bottom: 25px;
    /* Slightly up */
    right: 25px;
    width: 65px;
    /* Slightly bigger */
    height: 65px;
    background: #25D366;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 10px 25px rgba(37, 211, 102, 0.4);
    cursor: pointer;
    z-index: 9999;
    /* Maximize visibility */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
    text-decoration: none;
}

.whatsapp-widget.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.whatsapp-widget:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 12px 20px rgba(37, 211, 102, 0.35);
}

.whatsapp-widget svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}