/* --- Custom Properties & Theme Setup --- */
:root {
    --bg-color: #fafaf7;
    --chat-bg: #fafaf7;
    --primary-color: #c8960c;
    /* Golden brown from target site */
    --primary-hover: #b08207;
    --primary-light: #f5edd0;
    /* Pale gold/beige */
    --text-main: #1c1c1c;
    --text-muted: #777777;
    --bubble-bot: #ffffff;
    --bubble-user: #f5edd0;
    /* Beige/gold-pale user bubble */
    --accent-red: #b71c1c;
    --accent-gold: #c8960c;
    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Montserrat', sans-serif;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* --- Resets & Base Styles --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    background-color: #121212;
    /* Dark outside background for desktop contrast */
    color: var(--text-main);
    line-height: 1.5;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

/* --- App Container (Mobile Wrapper) --- */
.app-container {
    width: 100%;
    max-width: 500px;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Messenger Header --- */
.chat-header {
    background-color: #5d4037;
    /* Pleasant warm brown */
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 3px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.back-btn {
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.avatar-container {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.expert-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.online-badge {
    position: absolute;
    bottom: 0;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #4caf50;
    border: 2px solid #ffffff;
    border-radius: 50%;
    animation: pulse-online 2s infinite;
}

@keyframes pulse-online {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.expert-info {
    min-width: 0;
}

.expert-name {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    /* Highly readable white text */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.expert-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #f5edd0;
    /* Highly readable pale gold/beige status */
}

.status-dot {
    width: 6px;
    height: 6px;
    background-color: #4caf50;
    border-radius: 50%;
    display: inline-block;
}

.status-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    /* White icons */
}

.action-icon {
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.action-icon:hover {
    background-color: rgba(255, 255, 255, 0.15);
    /* Soft transparent white hover */
}

/* --- Main Chat Area --- */
.chat-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    background-color: #fafaf7;
    /* Off-white background */
    background-image: radial-gradient(rgba(200, 150, 12, 0.08) 1.5px, transparent 0),
        radial-gradient(rgba(200, 150, 12, 0.08) 1.5px, transparent 0);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
    padding: 16px;
    overflow-y: auto;
}

.chat-history {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

/* --- System Notices --- */
.system-time {
    align-self: center;
    font-size: 11px;
    color: var(--text-muted);
    background-color: rgba(255, 255, 255, 0.7);
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.system-notice {
    align-self: center;
    font-size: 11px;
    color: #5d4037;
    background-color: #f5edd0;
    /* Pale gold/beige */
    padding: 6px 12px;
    border-radius: 8px;
    text-align: center;
    max-width: 90%;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(200, 150, 12, 0.25);
}

/* --- Chat Bubbles --- */
.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    position: relative;
    animation: slide-in 0.3s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

@keyframes slide-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
}

.message-bubble {
    padding: 10px 14px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    font-size: 14.5px;
    position: relative;
}

.bot .message-bubble {
    background-color: var(--bubble-bot);
    color: var(--text-main);
    border-radius: 0 16px 16px 16px;
    border-left: 3px solid var(--primary-color);
}

.user .message-bubble {
    background-color: var(--bubble-user);
    color: #1f2937;
    border-radius: 16px 0 16px 16px;
}

.message-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #888888;
    margin-top: 4px;
    align-self: flex-end;
}

.bot-author-name {
    font-size: 10px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2px;
}

/* --- Typing Indicator --- */
.typing-indicator {
    align-self: flex-start;
    margin-bottom: 12px;
}

.typing-bubble {
    background-color: var(--bubble-bot);
    padding: 12px 18px;
    border-radius: 0 16px 16px 16px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.typing-bubble .dot {
    width: 6px;
    height: 6px;
    background-color: #888888;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-bubble .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-bubble .dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing-bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* --- Interactive Chat Controls (Survey Options) --- */
.chat-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0;
}

.control-btn {
    background: #ffffff;
    border: 2px solid var(--primary-color);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: 12px;
    font-family: var(--font-sans);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.control-btn:hover {
    background-color: var(--primary-light);
    transform: translateY(-1px);
}

.control-btn:active {
    transform: translateY(1px);
}

/* --- Wheel of Fortune Section --- */
.wheel-section {
    background-color: #ffffff;
    border-radius: 18px;
    padding: 20px 16px;
    margin: 16px 0;
    box-shadow: var(--shadow-md);
    border: 2px dashed var(--primary-color);
    animation: scale-up 0.4s ease-out forwards;
}

@keyframes scale-up {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.wheel-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 6px;
}

.wheel-subtitle {
    font-size: 13px;
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.wheel-wrapper {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 0 auto 15px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wheel-arrow {
    position: absolute;
    top: -15px;
    font-size: 26px;
    color: var(--accent-red);
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    transition: transform 5s cubic-bezier(0.2, 0.8, 0.1, 1);
    box-shadow: var(--shadow-lg);
}

.spin-btn {
    position: absolute;
    width: 74px;
    height: 74px;
    background: radial-gradient(circle, #f5edd0 0%, #c8960c 100%);
    border: 3px solid #ffffff;
    border-radius: 50%;
    color: #1c1c1c;
    font-family: var(--font-heading);
    font-size: 9px;
    line-height: 1.1;
    font-weight: 800;
    text-align: center;
    cursor: pointer;
    box-shadow: var(--shadow-md), 0 0 10px rgba(200, 150, 12, 0.6);
    z-index: 5;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
    transition: transform 0.1s;
}

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

/* --- Order Section & Checkout Form --- */
.order-section {
    margin: 16px 0;
    animation: fade-in 0.5s ease-out forwards;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.order-card {
    background-color: #ffffff;
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    border: 1px solid #e0e0e0;
    overflow: hidden;
}

.order-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    padding: 16px;
    color: #ffffff;
    text-align: center;
}

.order-badge {
    background-color: var(--accent-red);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 12px;
    margin-bottom: 8px;
    display: inline-block;
    letter-spacing: 0.5px;
    animation: flash 1s infinite alternate;
}

@keyframes flash {
    from {
        opacity: 0.7;
    }

    to {
        opacity: 1;
        transform: scale(1.05);
    }
}

.order-title {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
}

.product-showcase {
    display: flex;
    padding: 16px;
    gap: 16px;
    border-bottom: 1px solid #eee;
    background-color: #fafafa;
}

.product-img-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.free-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--accent-red);
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transform: rotate(10deg);
}

.product-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.product-name {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 700;
    color: var(--primary-color);
}

.product-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.price-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.price-old {
    font-size: 14px;
    text-decoration: line-through;
    color: var(--text-muted);
}

.price-new {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    color: var(--accent-red);
    animation: text-pulse 1.5s infinite;
}

@keyframes text-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.price-note {
    font-size: 9px;
    color: var(--text-muted);
    font-style: italic;
}

/* Urgency / Stock Containers */
.urgency-container {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border-bottom: 1px solid #eee;
}

.timer-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f5edd0;
    border: 1px solid rgba(200, 150, 12, 0.3);
    padding: 10px 14px;
    border-radius: 10px;
}

.timer-label {
    font-size: 13px;
    font-weight: 600;
    color: #5d4037;
}

.timer-countdown {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 800;
    color: var(--accent-red);
    letter-spacing: 1px;
}

.stock-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stock-label {
    display: flex;
    justify-content: space-between;
    font-size: 12.5px;
}

.stock-label strong {
    color: var(--accent-red);
}

.stock-bar {
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.stock-progress {
    height: 100%;
    background-color: var(--accent-red);
    border-radius: 4px;
    transition: width 0.8s ease-in-out;
}

/* Order Form Styling */
.order-form {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-main);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
}

.order-form input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 14.5px;
    outline: none;
    transition: border-color 0.2s;
}

.order-form input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

.submit-btn {
    background: linear-gradient(135deg, #c8960c 0%, #9c7104 100%);
    color: #ffffff;
    border: none;
    padding: 15px;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(200, 150, 12, 0.4);
    animation: pulse-button 1.8s infinite;
    transition: transform 0.1s;
}

.submit-btn:active {
    transform: scale(0.98);
}

@keyframes pulse-button {
    0% {
        box-shadow: 0 0 0 0 rgba(200, 150, 12, 0.6);
    }

    70% {
        box-shadow: 0 0 0 12px rgba(200, 150, 12, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(200, 150, 12, 0);
    }
}

.trust-badges {
    background-color: #fafafa;
    padding: 14px 16px;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.badge-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.badge-icon {
    font-size: 14px;
}

.badge-text {
    font-size: 11.5px;
    color: #555555;
    line-height: 1.3;
}

/* --- Reviews Section & Comments Feed --- */
.reviews-section {
    margin-top: 24px;
    border-top: 1px solid #d4c8be;
    padding-top: 20px;
}

.reviews-section-title {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: #5d4037;
    /* Warm brown */
    margin-bottom: 16px;
    text-align: center;
}

.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.review-item {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.review-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.reviewer-avatar {
    width: 38px;
    height: 38px;
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 13px;
}

.reviewer-info {
    display: flex;
    flex-direction: column;
}

.reviewer-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-main);
}

.reviewer-age {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 12px;
    margin-left: 4px;
}

.review-date {
    font-size: 10px;
    color: var(--text-muted);
}

.review-text {
    font-size: 13px;
    color: #333333;
    line-height: 1.4;
}

.review-media {
    margin-top: 10px;
    background-color: #f7f7f7;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.media-title {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.review-img {
    max-width: 100%;
    border-radius: 6px;
    display: block;
}

/* --- Win Modal Popup --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    background-color: #ffffff;
    border-radius: 20px;
    width: 100%;
    max-width: 360px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(30px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.modal-message {
    font-size: 14.5px;
    color: var(--text-main);
    margin-bottom: 6px;
}

.modal-submessage {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 18px;
}

.modal-btn {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    width: 100%;
    transition: background-color 0.2s;
}

.modal-btn:hover {
    background-color: var(--primary-hover);
}