/* ============================================
   Lovu Custom Styles
   Modern, Professional Design System
   ============================================ */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
    /* Primary Colors - Sky Blue (from logo) */
    --primary-50: #f0f9ff;
    --primary-100: #e0f2fe;
    --primary-200: #bae6fd;
    --primary-300: #7dd3fc;
    --primary-400: #38bdf8;
    --primary-500: #0ea5e9;
    --primary-600: #0284c7;
    --primary-700: #0369a1;
    --primary-800: #075985;
    --primary-900: #0c4a6e;

    /* Accent Colors - Rose/Coral (from logo) */
    --accent-50: #fef2f2;
    --accent-100: #fee4e2;
    --accent-200: #fecdd3;
    --accent-300: #fda4af;
    --accent-400: #fb7185;
    --accent-500: #f43f5e;
    --accent-600: #e11d48;
    --accent-700: #be123c;
    --accent-800: #9f1239;
    --accent-900: #881337;

    /* Secondary Colors - Amber/Gold */
    --secondary-50: #fffbeb;
    --secondary-100: #fef3c7;
    --secondary-200: #fde68a;
    --secondary-500: #f59e0b;
    --secondary-600: #d97706;

    /* Neutral Colors */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2rem;
    --radius-2xl: 2.5rem;
    --radius-full: 9999px;

    /* Shadows */
    --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-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 200ms ease-in-out;
    --transition-slow: 300ms ease-in-out;
}

/* ============================================
   Tailwind Extension Classes
   ============================================ */

/* Primary Color Classes */
.text-primary-600 {
    color: var(--primary-600);
}

.bg-primary-600 {
    background-color: var(--primary-600);
}

.bg-primary-50 {
    background-color: var(--primary-50);
}

.bg-primary-100 {
    background-color: var(--primary-100);
}

.border-primary-500 {
    border-color: var(--primary-500);
}

.hover\:bg-primary-700:hover {
    background-color: var(--primary-700);
}

.hover\:text-primary-700:hover {
    color: var(--primary-700);
}

.focus\:ring-primary-500:focus {
    --tw-ring-color: var(--primary-500);
}

/* Accent Color Classes */
.text-accent-600 {
    color: var(--accent-600);
}

.bg-accent-600 {
    background-color: var(--accent-600);
}

.bg-accent-50 {
    background-color: var(--accent-50);
}

.bg-accent-100 {
    background-color: var(--accent-100);
}

.border-accent-500 {
    border-color: var(--accent-500);
}

.hover\:bg-accent-700:hover {
    background-color: var(--accent-700);
}

.hover\:text-accent-700:hover {
    color: var(--accent-700);
}

/* ============================================
   Animations & Keyframes
   ============================================ */

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide In Animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale In Animation */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Shake Animation (for errors) */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Shimmer Animation (for loading states) */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Animation Classes */
.animate-in {
    animation: fadeIn 0.4s ease-out forwards;
}

.animate-slide-in {
    animation: slideIn 0.5s ease-out forwards;
}

.animate-scale-in {
    animation: scaleIn 0.3s ease-out forwards;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-shake {
    animation: shake 0.3s ease-in-out;
}

/* ============================================
   Global Styles & Resets
   ============================================ */

* {
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    word-break: keep-all;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Focus visible improvements for accessibility */
*:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* ============================================
   Custom Utility Classes
   ============================================ */

/* Glass morphism effect */
.glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, var(--primary-600), var(--accent-500));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Smooth scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ============================================
   Component-Specific Styles
   ============================================ */

/* Toggle Chip Active State */
.chip-active {
    background-color: #fff1f2 !important;
    color: #e11d48 !important;
    border: 2px solid #f43f5e;
}

/* Survey Choice Buttons with Selected State */
.choice-btn.selected {
    background-color: var(--primary-50);
    border-color: var(--primary-500);
    color: var(--primary-600);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}

/* Error Message Styling */
#error-message {
    animation: slideIn 0.3s ease-out;
}

/* Modal Overlay */
#surveyModal {
    animation: fadeIn 0.3s ease-out;
}

#surveyModal > div {
    animation: scaleIn 0.3s ease-out;
}

/* Loading State */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-600);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Responsive Utilities
   ============================================ */

/* Hide on mobile */
@media (max-width: 768px) {
    .hide-mobile {
        display: none;
    }
}

/* Show only on mobile */
@media (min-width: 769px) {
    .show-mobile {
        display: none;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    header,
    footer,
    #surveyModal {
        display: none;
    }

    body {
        background: white;
    }

    a[href^="http"]:after {
        content: " (" attr(href) ")";
    }
}

/* ============================================
   Accessibility Enhancements
   ============================================ */

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--primary-600);
    color: white;
    padding: 0.5rem 1rem;
    z-index: 1000;
    transition: top var(--transition-fast);
}

.skip-to-main:focus {
    top: 0;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-600: #0066cc;
        --accent-600: #cc0033;
    }

    button,
    a {
        text-decoration: underline;
    }
}

/* ============================================
   Dark Mode Support (Optional - Future Enhancement)
   ============================================ */

@media (prefers-color-scheme: dark) {
    /* Uncomment if dark mode is needed in the future
    :root {
        --gray-50: #1f2937;
        --gray-900: #f9fafb;
    }

    body {
        background-color: var(--gray-900);
        color: var(--gray-100);
    }
    */
}

/* ============================================
   Performance Optimizations
   ============================================ */

/* GPU acceleration for animations */
.will-animate {
    will-change: transform, opacity;
}

/* Prevent layout shift */
img,
video {
    max-width: 100%;
    height: auto;
}

/* ============================================
   Chatbot Widget Styles
   ============================================ */

/* Chatbot Container */
#chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Floating Toggle Button */
.chatbot-toggle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f43f5e, #fb7185);
    border: none;
    box-shadow: 0 8px 24px rgba(244, 63, 94, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    animation: pulse-chat 2s infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(244, 63, 94, 0.5);
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

.chatbot-icon {
    width: 40px;
    height: 40px;
    color: white;
}

/* Tooltip */
.chatbot-tooltip {
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    background: white;
    color: #374151;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 1;
    visibility: visible;
    transition: all 0.3s ease;
    pointer-events: none;
    animation: float-tooltip 2s ease-in-out infinite;
}

.chatbot-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 16px;
    width: 0;
    height: 0;
    border-top: 6px solid white;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
}

@keyframes float-tooltip {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* Notification Badge */
.chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #fbbf24;
    color: #78350f;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    animation: bounce-badge 1s ease infinite;
}

.chatbot-badge.hidden {
    display: none;
}

/* Chat Window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

.chatbot-window.hidden {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #f43f5e, #fb7185);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: white;
    padding: 6px;
    object-fit: contain;
}

.chatbot-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.chatbot-status {
    font-size: 13px;
    margin: 0;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    animation: pulse-dot 2s infinite;
}

.chatbot-close-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-close-btn svg {
    width: 24px;
    height: 24px;
}

.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Messages Container */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

/* Message Bubble */
.message {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    animation: slideUp 0.3s ease;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: white;
    border: 2px solid #e5e7eb;
}

.message.bot .message-avatar {
    background: linear-gradient(135deg, #f43f5e, #fb7185);
    border: none;
}

.message-content {
    max-width: 75%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-line;
}

.message.bot .message-bubble {
    background: white;
    color: #111827;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message.user .message-bubble {
    background: #f43f5e;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #9ca3af;
    padding: 0 4px;
}

/* Quick Reply Buttons */
.quick-replies {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

/* KakaoTalk Channel Button */
.kakao-channel-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.875rem;
    padding: 0.625rem 1.25rem;
    background: #FEE500;
    color: #3A1D1D;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 0.875rem;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(254, 229, 0, 0.4);
}

.kakao-channel-btn:hover {
    background: #f5dc00;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(254, 229, 0, 0.5);
}

.quick-reply-btn {
    background: white;
    border: 2px solid #f43f5e;
    color: #f43f5e;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-reply-btn:hover {
    background: #fef2f2;
    transform: translateX(4px);
}

.quick-reply-btn:active {
    transform: scale(0.98);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.action-btn {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
}

.action-btn.primary {
    background: #fef08a;
    color: #78350f;
}

.action-btn.primary:hover {
    background: #fde047;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(254, 240, 138, 0.4);
}

.action-btn.secondary {
    background: #f3f4f6;
    color: #374151;
}

.action-btn.secondary:hover {
    background: #e5e7eb;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* Input Area */
.chatbot-input-wrapper {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}

.chatbot-input:focus {
    border-color: #f43f5e;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.1);
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #f43f5e;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chatbot-send-btn svg {
    width: 20px;
    height: 20px;
}

.chatbot-send-btn:hover {
    background: #e11d48;
    transform: scale(1.05);
}

.chatbot-send-btn:active {
    transform: scale(0.95);
}

.chatbot-send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

/* Animations */
@keyframes pulse-chat {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(244, 63, 94, 0.4);
    }
    50% {
        box-shadow: 0 8px 32px rgba(244, 63, 94, 0.6);
    }
}

@keyframes bounce-badge {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #chatbot-widget {
        bottom: 16px;
        right: 16px;
    }

    .chatbot-toggle {
        width: 70px;
        height: 70px;
    }

    .chatbot-icon {
        width: 36px;
        height: 36px;
    }

    .chatbot-tooltip {
        font-size: 12px;
        padding: 8px 12px;
        bottom: calc(100% + 10px);
    }

    .chatbot-window {
        bottom: 88px;
        right: 16px;
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        max-height: none;
        border-radius: 20px;
    }

    .chatbot-header {
        padding: 16px;
    }

    .chatbot-logo {
        width: 36px;
        height: 36px;
    }

    .chatbot-title {
        font-size: 16px;
    }

    .chatbot-messages {
        padding: 16px;
    }

    .message-content {
        max-width: 80%;
    }

    .chatbot-input-wrapper {
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .message-content {
        max-width: 85%;
    }
}

/* ============================================
   Use Case Section Styles
   ============================================ */

/* Hero Description */
.hero-description {
    animation: fadeIn 0.6s ease-out 0.2s both;
}

/* Use Case Section */
.use-case-section {
    animation: fadeIn 0.6s ease-out;
}

.use-case-section .problem-item {
    transition: all 0.3s ease;
}

.use-case-section .problem-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.use-case-section .solution {
    transition: all 0.3s ease;
    animation: scaleIn 0.5s ease-out 0.3s both;
}

.use-case-section .solution:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 24px rgba(244, 63, 94, 0.3);
}

/* Mobile Responsive for Use Case Section */
@media (max-width: 768px) {
    .hero-description {
        font-size: 1rem;
        padding: 0 1rem;
    }

    .use-case-section .problem-item {
        padding: 1rem 1.25rem;
    }

    .use-case-section .icon,
    .use-case-section .checkmark {
        font-size: 1.5rem;
    }

    .use-case-section .solution {
        padding: 1rem 2rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .use-case-section .solution-text {
        font-size: 1rem;
    }
}
