/* CSS Design System for NeuroRest (НейроРест) Chat Lander */

:root {
    --navy-primary: #004b87;
    --navy-light: #eef4fa;
    --navy-dark: #0f172a;
    --navy-accent: #0056b3;
    
    --gray-bg: #f8fafc;
    --gray-border: #e2e8f0;
    
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --accent-orange: #ff6f00;
    --accent-orange-hover: #e65100;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    
    --bubble-bot: #f1f5f9;
    --bubble-user: #004b87;
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-premium: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}

/* Reset and Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-primary);
    background: radial-gradient(circle at top right, #f1f5f9 0%, #cbd5e1 100%);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: stretch;
}

/* Main Container Layout */
.page-container {
    width: 100%;
    max-width: 600px;
    background: #ffffff;
    box-shadow: var(--shadow-premium);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* Sticky Chat Header */
.chat-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #004b87; /* Pleasant blue brand color */
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding: 12px 16px;
    box-shadow: var(--shadow-sm);
}

.doctor-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.doctor-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: var(--navy-light);
}

.online-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background-color: var(--accent-green);
    border: 2px solid #004b87;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

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

.doctor-name {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.doctor-status {
    font-size: 11px;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

.doctor-online-text {
    font-size: 10px;
    font-weight: 600;
    color: #4ade80;
    margin-top: 1px;
}

/* Chat Messages Area */
.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 350px;
    background: #f8fafc;
    background-image: radial-gradient(#e2e8f0 0.5px, transparent 0.5px), radial-gradient(#e2e8f0 0.5px, #f8fafc 0.5px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    scroll-behavior: smooth;
}

/* Message Bubbles */
.message-row {
    display: flex;
    width: 100%;
    margin-bottom: 2px;
}

.message-row.bot-row {
    justify-content: flex-start;
}

.message-row.user-row {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 85%;
    padding: 12px 16px;
    font-size: 14.5px;
    line-height: 1.45;
    position: relative;
    box-shadow: var(--shadow-sm);
    animation: bubble-appear 0.3s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes bubble-appear {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.bot-row .message-bubble {
    background-color: #ffffff;
    color: var(--text-primary);
    border-radius: 18px 18px 18px 4px;
    border: 1px solid var(--gray-border);
}

.user-row .message-bubble {
    background-color: var(--navy-primary);
    color: #ffffff;
    border-radius: 18px 18px 4px 18px;
}

.message-time {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: right;
}

.user-row .message-time {
    color: rgba(255, 255, 255, 0.7);
}

/* Typing Indicator */
.typing-bubble {
    background-color: #ffffff;
    border: 1px solid var(--gray-border);
    border-radius: 18px 18px 18px 4px;
    padding: 12px 18px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
}

.typing-dot {
    width: 7px;
    height: 7px;
    background-color: var(--text-muted);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

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

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Chat Options / Interaction Panel */
.chat-options-panel {
    background: #ffffff;
    border-top: 1px solid var(--gray-border);
    padding: 16px;
    position: sticky;
    bottom: 0;
    z-index: 40;
}

.chat-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.option-btn {
    width: 100%;
    padding: 14px 18px;
    background-color: var(--navy-light);
    color: var(--navy-primary);
    border: 1px solid rgba(0, 75, 135, 0.15);
    border-radius: 12px;
    font-size: 14.5px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: button-pop 0.3s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes button-pop {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.option-btn:hover {
    background-color: var(--navy-primary);
    color: #ffffff;
    border-color: var(--navy-primary);
}

.option-btn::after {
    content: "➔";
    font-size: 14px;
    opacity: 0.7;
}

/* Sections General Styling */
.offer-section, .order-section, .reviews-section {
    padding: 20px 16px;
    background: #ffffff;
    border-top: 1px solid var(--gray-border);
}

.offer-card, .order-card {
    background: #ffffff;
    border: 1px solid var(--gray-border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-md);
}

/* Offer Section Styling */
.offer-title {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--navy-dark);
    margin-bottom: 10px;
    text-align: center;
}

.offer-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    text-align: center;
    margin-bottom: 16px;
}

.wheel-instructions {
    background-color: var(--navy-light);
    border-left: 4px solid var(--navy-primary);
    padding: 10px 14px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 24px;
    font-size: 13.5px;
    color: var(--navy-dark);
}

/* Wheel of Fortune Styling */
.wheel-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    /* Fixed height prevents page reflow during wheel spin animation */
    min-height: 320px;
    margin: 20px 0 10px 0;
}

.wheel-container {
    position: relative;
    width: 280px;
    height: 280px;
}

.wheel-pointer {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 28px;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 8px solid var(--navy-dark);
    position: relative;
    overflow: hidden;
    transition: transform 5s cubic-bezier(0.15, 0.85, 0.25, 1);
    box-shadow: var(--shadow-lg), 0 0 15px rgba(0, 75, 135, 0.2);
}

.wheel-segment {
    position: absolute;
    width: 50%;
    height: 50%;
    left: 50%;
    top: 50%;
    transform-origin: 0% 0%;
    background-color: var(--bg);
    transform: rotate(calc(60deg * var(--i))) skewY(30deg);
}

.wheel-text {
    position: absolute;
    width: 44%;
    height: 44px;
    left: 50%;
    top: 50%;
    transform-origin: 0% 50%;
    padding-right: 10px;
    font-size: 8.5px;
    font-weight: 700;
    white-space: normal;
    word-break: break-word;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
    box-sizing: border-box;
    z-index: 5;
    pointer-events: none;
    transform: translateY(-50%) rotate(calc(60deg * var(--i) + 60deg));
    line-height: 1.25;
    overflow: hidden;
}

.wheel-text span {
    display: inline-block;
    max-width: 100%;
    transition: transform 0.3s ease;
}

/* Rotate left side segments in place by 180 degrees so they read right-side up */
.wheel-text[style*="--i:2"] span,
.wheel-text[style*="--i:3"] span,
.wheel-text[style*="--i:4"] span {
    transform: rotate(180deg);
}

.wheel-spin-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffffff 0%, #e2e8f0 100%);
    border: 4px solid var(--navy-dark);
    font-size: 11px;
    font-weight: 800;
    color: var(--navy-dark);
    cursor: pointer;
    box-shadow: var(--shadow-md), 0 0 8px rgba(0,0,0,0.2);
    z-index: 12;
    transition: var(--transition-fast);
}

.wheel-spin-btn:hover {
    transform: translate(-50%, -50%) scale(1.05);
}

.wheel-spin-btn:active {
    transform: translate(-50%, -50%) scale(0.95);
}

/* Hide spin button after it's been clicked */
.wheel-spin-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.5);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Order Section Styling */
.badge-success-glow {
    background: linear-gradient(135deg, var(--accent-green) 0%, #059669 100%);
    color: #ffffff;
    font-weight: 700;
    text-align: center;
    font-size: 13.5px;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
    animation: pulse-glow 2s infinite alternate;
}

@keyframes pulse-glow {
    from {
        box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
    }
    to {
        box-shadow: 0 4px 15px rgba(16, 185, 129, 0.5);
    }
}

.product-presentation {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
}

.product-image-container {
    width: 100px;
    flex-shrink: 0;
    border: 1px solid var(--gray-border);
    border-radius: 12px;
    padding: 8px;
    background: var(--gray-bg);
}

.product-image {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.product-deal-info {
    display: flex;
    flex-direction: column;
}

.product-title {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--navy-dark);
    line-height: 1.3;
}

.product-tagline {
    font-size: 11.5px;
    color: var(--text-muted);
    margin: 4px 0 8px 0;
}

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

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

.price-new {
    font-size: 20px;
    font-weight: 800;
    color: var(--accent-orange);
    animation: blink-orange 1.5s infinite;
}

@keyframes blink-orange {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

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

/* Urgency Triggers */
.urgency-triggers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.timer-box, .stock-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--gray-bg);
    border: 1px dashed var(--gray-border);
    padding: 10px;
    border-radius: 10px;
}

.timer-icon, .stock-icon {
    font-size: 20px;
}

.timer-text, .stock-text {
    display: flex;
    flex-direction: column;
}

.timer-label, .stock-label {
    font-size: 10px;
    color: var(--text-secondary);
}

.timer-countdown {
    font-family: monospace;
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-red);
}

.stock-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--navy-primary);
}

/* Form Styling */
.checkout-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.input-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--gray-border);
    border-radius: 8px;
    font-size: 14.5px;
    outline: none;
    transition: var(--transition-fast);
}

.input-group input:focus {
    border-color: var(--navy-primary);
    box-shadow: 0 0 0 3px rgba(0, 75, 135, 0.1);
}

.submit-btn {
    width: 100%;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-orange-hover) 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(230, 81, 0, 0.35);
    transition: var(--transition-normal);
    animation: pulse-button 2s infinite;
}

@keyframes pulse-button {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(230, 81, 0, 0.3);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 6px 20px rgba(230, 81, 0, 0.45);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(230, 81, 0, 0.3);
    }
}

.submit-btn:hover {
    background: linear-gradient(135deg, var(--accent-orange-hover) 0%, #bf360c 100%);
}

.form-badges {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
    border-top: 1px solid var(--gray-border);
    padding-top: 10px;
}

.form-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: var(--text-secondary);
}

/* Reviews Styling */
.reviews-heading {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--navy-dark);
    margin-bottom: 16px;
    border-bottom: 2px solid var(--navy-light);
    padding-bottom: 8px;
}

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

.review-card {
    background-color: var(--gray-bg);
    border: 1px solid var(--gray-border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--gray-border);
    padding-bottom: 6px;
}

.review-author {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--navy-primary);
}

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

.review-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.review-image-wrapper {
    margin-top: 12px;
    border: 1px solid var(--gray-border);
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    max-width: 320px;
}

.review-image {
    width: 100%;
    height: auto;
    display: block;
}

.image-label {
    display: block;
    font-size: 10.5px;
    text-align: center;
    padding: 6px;
    color: var(--text-muted);
    background-color: var(--navy-light);
    font-weight: 500;
}

/* Confetti styling */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 8px;
    height: 16px;
    background-color: #f00;
    opacity: 0.85;
    animation: confetti-fall 3.5s linear infinite;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-20px) rotate(0deg);
    }
    100% {
        transform: translateY(105vh) rotate(360deg);
    }
}

/* Responsiveness overrides */
@media (max-width: 600px) {
    body {
        background: #ffffff;
    }
    .page-container {
        box-shadow: none;
    }
    .chat-header {
        position: sticky;
    }
}
