/* ============================================
   SEMAR AI CHAT - STYLES
   Theme: Futuristic Apple OS-like UI/UX
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ============================================
   ROOT VARIABLES
   ============================================ */
:root {
    /* Colors */
    --bg-dark: #050505;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --bg-message-user: rgba(121, 40, 202, 0.2);
    --bg-message-ai: rgba(255, 255, 255, 0.05);
    
    /* Accent Colors */
    --accent-pink: #ff0080;
    --accent-purple: #7928ca;
    --accent-blue: #4299e1;
    --accent-green: #48bb78;
    --accent-orange: #f6ad55;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-tertiary: rgba(255, 255, 255, 0.5);
    
    /* Glass Effect */
    --glass-blur: blur(25px);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-border-hover: rgba(255, 255, 255, 0.2);
    
    /* Shadows */
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(121, 40, 202, 0.2);
    
    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-medium: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    /* Border Radius */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    background: var(--bg-dark);
    overflow-x: hidden;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   FLUID MORPHING BACKGROUND
   ============================================ */
.fluid-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.6;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: morph 12s ease-in-out infinite alternate;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: linear-gradient(45deg, var(--accent-pink), var(--accent-purple));
    top: 10%;
    left: 10%;
}

.blob-2 {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
    top: 50%;
    left: 30%;
    animation-duration: 18s;
    animation-delay: -2s;
}

.blob-3 {
    width: 450px;
    height: 450px;
    background: linear-gradient(225deg, var(--accent-orange), var(--accent-pink));
    top: 20%;
    right: 10%;
    animation-duration: 15s;
    animation-delay: -5s;
}

@keyframes morph {
    0%, 100% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    25% {
        border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%;
        transform: translate(50px, 30px) rotate(90deg) scale(1.05);
    }
    50% {
        border-radius: 70% 30% 50% 50% / 30% 60% 40% 70%;
        transform: translate(100px, 50px) rotate(180deg) scale(0.95);
    }
    75% {
        border-radius: 40% 60% 60% 40% / 50% 40% 60% 50%;
        transform: translate(-50px, 80px) rotate(270deg) scale(1.02);
    }
}

/* DISABLE DYNAMIC BACKGROUND ON MOBILE TABLETS */
@media (max-width: 768px) {
    .blob {
        animation: none !important; /* Stop all blob animations */
    }
    
    /* Keep static gradient colors but no movement */
    .blob-1 {
        animation: none !important;
    }
    
    .blob-2 {
        animation: none !important;
    }
    
    .blob-3 {
        animation: none !important;
    }
}

/* ============================================
   PARTICLE CANVAS
   ============================================ */
.sparkle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 100;
}

/* ============================================
   MAIN CONTAINER
   ============================================ */
.main-container {
    position: relative;
    z-index: 10;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
    padding-bottom: 70px; /* Extra space at bottom for mobile keyboard avoidance */
}

/* ============================================
   HEADER
   ============================================ */
.header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.8s ease-out;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.logo-image {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(255, 0, 128, 0.3);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 10px 30px rgba(255, 0, 128, 0.3); }
    50% { transform: scale(1.05); box-shadow: 0 15px 40px rgba(255, 0, 128, 0.4); }
}

.logo-text h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, rgba(255, 255, 255, 0.7));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.logo-text p {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* ============================================
   GLASS CONTAINER
   ============================================ */
.glass-container {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-slow);
}

.glass-container:hover {
    background: var(--bg-card-hover);
    border-color: var(--glass-border-hover);
}

/* ============================================
   WELCOME CARD
   ============================================ */
.welcome-card {
    padding: 32px 40px;
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.feature-icon {
    font-size: 2rem;
}

.feature-item span:last-child {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   CHAT HISTORY
   ============================================ */
.chat-history {
    margin-bottom: 40px;
    animation: fadeInUp 0.8s ease-out;
    max-height: 500px;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
}

.chat-history::-webkit-scrollbar {
    width: 0;
    display: none; /* Chrome, Safari, Edge */
}

/* Removed scrollbar track and thumb for chat-history */

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
}

/* Message Styles */
.message {
    display: flex;
    gap: 12px;
    animation: messageSlide 0.4s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.5rem;
    overflow: hidden;
}

.message.ai .message-avatar {
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
}

.message-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.message-content {
    flex: 1;
    max-width: 80%;
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    line-height: 1.6;
    
    /* Auto expand for user messages */
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

.message.ai .message-content {
    background: var(--bg-message-ai);
    border: 1px solid var(--glass-border);
    border-top-left-radius: var(--radius-sm);
    
    /* FIXED HEIGHT + HIDDEN SCROLL for AI answers */
    max-height: 300px;              /* Limit height ~7-8 lines */
    overflow-y: auto;               /* Internal vertical scroll (hidden) */
    overflow-x: hidden;             /* No horizontal scroll */
    overflow-wrap: break-word;      /* Break long words */
    white-space: pre-wrap;          /* Preserve whitespace */
}

/* Hide scrollbar for Firefox */
.message.ai .message-content {
    scrollbar-width: none;
    -ms-overflow-style: none;  /* IE/Edge */
}

/* Hide scrollbar for Chrome/Safari/Opera */
.message.ai .message-content::-webkit-scrollbar {
    display: none;              /* Hide completely */
    width: 0;                   /* No width */
    height: 0;                  /* No height */
}

.message.user .message-content {
    background: var(--bg-message-user);
    border: 1px solid rgba(121, 40, 202, 0.3);
    border-top-right-radius: var(--radius-sm);
}

.message-content p {
    margin-bottom: 12px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 12px 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.message-content code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message-content ul,
.message-content ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.message-content li {
    margin-bottom: 8px;
}

/* ============================================
   MESSAGE LAYOUT WITH FIXED ICON
   ============================================ */
.message {
    display: flex;
    gap: 12px;
    animation: messageSlide 0.4s ease-out;
}

.message.avatar-image-wrapper {
    flex-shrink: 0;
}

.message-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.message-content {
    flex: 1;
    max-width: 80%;
    padding: 8px 16px; /* Reduced default padding for shorter messages */
    border-radius: var(--radius-lg);
    line-height: 1.5;

    /* Auto expand for user messages */
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
    text-align: left !important;

    /* No indent on paragraphs - always flush left */
    text-indent: 0 !important;
    margin: 0;
}

/* NEW: Wrapper structure for AI messages with fixed icon */
.message-wrapper {
    position: relative;
    max-width: 80%;
}

.message-content-inner {
    background: var(--bg-message-ai);
    border: 1px solid var(--glass-border);
    border-top-left-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
    border-top-right-radius: var(--radius-md);
    padding: 8px 16px; /* Reduced default padding for shorter messages */
    line-height: 1.5;
    overflow-wrap: break-word;
    word-wrap: break-word;
    text-align: left !important;
    
    /* Allow natural height growth, only constrain VERY long texts */
    min-height: auto !important; /* Remove minimum height constraint */
    max-height: none !important;  /* Remove max-height to fit short texts naturally */

    /* No indent on paragraphs - always flush left */
    text-indent: 0 !important;
    margin: 0;

    /* SPACE FOR ICON: Add bottom padding for 1 line gap before icon */
    padding-bottom: 26px !important; /* 1 line (15px) + icon size (11px) */

    /* Positioning for icon */
    position: relative;
    z-index: 1;
}

/* Ensure no indentation for paragraphs inside chat bubbles */
.message-content-inner p,
.message-content-inner div,
.message-content-inner span {
    text-indent: 0 !important;
    margin: 0;
}

/* Hide scrollbar for Firefox */
.message-content-inner {
    scrollbar-width: none;
    -ms-overflow-style: none;  /* IE/Edge */
}

/* Hide scrollbar for Chrome/Safari/Opera */
.message-content-inner::-webkit-scrollbar {
    display: none;              /* Hide completely */
    width: 0;                   /* No width */
    height: 0;                  /* No height */
}

/* Fixed position icon at bottom right - ALWAYS visible */
.message-tts-container {
    position: absolute !important;
    bottom: 4px !important;       /* Closer to edge but inside */
    right: 4px !important;         /* Closer to edge but inside */
    z-index: 100; /* HIGH z-index to be on top */
    pointer-events: auto;
}

@media (max-width: 768px) {
    .message-tts-container {
        bottom: 2px !important;   /* Even tighter on tablet */
        right: 2px !important;
    }
}

@media (max-width: 480px) {
    .message-tts-container {
        bottom: 2px !important;   /* Ultra close on mobile */
        right: 2px !important;    /* Keep it inside bubble */
    }
    
    .send-btn {
        width: 56px !important;
        height: 56px !important;
        min-width: 56px;
        min-height: 56px;
        border-radius: 50% !important; /* Make it round for easy tapping */
    }

    /* Optimized icon size */
    .tts-btn svg {
        width: 12px;
        height: 12px;
    }

    .tts-icon-text {
        display: none;
    }

    /* Optimize input field for mobile */
    #userInput {
        font-size: 16px !important;      /* Prevent iOS zoom */
        line-height: 1.5;
        padding: 12px 16px !important;   /* Easier to tap/click */
        border-radius: 12px !important;
        min-height: 44px !important;     /* Apple recommended touch target */
        max-height: 120px !important;
    }

    /* Smooth scroll behavior */
    .chat-history,
    html,
    body {
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        scroll-behavior: smooth;
    }

    /* Better focus styling for inputs */
    #userInput:focus {
        outline: none;
        border-color: var(--accent-pink) !important;
        box-shadow: 0 0 0 3px rgba(255, 0, 128, 0.3) !important;
        background: rgba(255, 255, 255, 0.1) !important;
    }

    /* Improve registration form for mobile */
    .form-group input,
    .form-group select {
        font-size: 16px !important;      /* Prevent iOS zoom */
        padding: 14px 16px !important;
        min-height: 48px !important;     /* Comfortable tap target */
        border-radius: 12px !important;
    }

    .submit-btn {
        min-height: 48px !important;
        font-size: 1rem !important;
        padding: 14px 24px !important;
        border-radius: 12px !important;
    }

    /* Disable zoom on input fields */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
}

.tts-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    
    /* NO BACKGROUND - Pure Icon Only */
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 4px; 
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    
    /* Make sure button is clickable */
    pointer-events: auto;
    z-index: 101; /* Even higher than container */
}

.tts-btn:hover {
    transform: scale(1.15);       
    filter: brightness(1.3);      
}

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

.tts-btn svg {
    width: 18px;
    height: 18px;
    stroke: #ffffff;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.tts-icon-text {
    font-size: 0.7rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1;
    margin-left: 4px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Speaking/Playing state - Green glow animation */
.tts-btn.speaking,
.tts-btn.playing {
    filter: drop-shadow(0 0 8px rgba(72, 187, 120, 0.8));
    animation: ttsPulse 1.5s ease-in-out infinite;
}

@keyframes ttsPulse {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(72, 187, 120, 0.8));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(72, 187, 120, 1));
    }
}

.tts-btn.speaking svg {
    stroke: #48bb78; 
}

.tts-btn.speaking .tts-icon-text {
    color: #48bb78;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .message-wrapper {
        max-width: 90%;
    }
    
    .message-content-inner,
    .message-content {
        max-width: 90%;
        padding: 10px 14px !important; /* Compact padding */
        
        /* Keep dynamic height - only constrain extremely long texts */
        max-height: none !important;
        
        /* Ensure no paragraph indentation on mobile/tablet */
        text-indent: 0 !important;
        
        /* SPACE FOR ICON ON TABLET */
        padding-bottom: 24px !important; /* 1 line gap + icon */
    }
    
    .message-content-inner p,
    .message-content-inner div,
    .message-content-inner span {
        text-indent: 0 !important;
        margin: 0;
    }
    
    .tts-btn svg {
        width: 14px;
        height: 14px;
    }

    .tts-icon-text {
        display: none;
    }
}

@media (max-width: 480px) {
    /* OPTIMIZED MOBILE EXPERIENCE */

    /* Prevent blue tap highlight on iOS/Android */
    * {
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none;
    }

    .message-wrapper {
        max-width: 92%;
    }

    .message-content-inner,
    .message-content {
        max-width: 92%;
        padding: 8px 12px !important; /* Minimal padding for short texts */

        /* Dynamic height - fit content perfectly */
        max-height: none !important;

        /* Ensure no paragraph indentation on mobile */
        text-indent: 0 !important;

        /* SPACE FOR ICON ON MOBILE */
        padding-bottom: 22px !important; /* 1 line gap + smaller icon */
    }

    .message-content-inner p,
    .message-content-inner div,
    .message-content-inner span {
        text-indent: 0 !important;
        margin: 0;
    }

    /* Larger touch target for send button */
    .send-btn {
        width: 56px !important;
        height: 56px !important;
        min-width: 56px;
        min-height: 56px;
        border-radius: 50% !important; /* Make it round for easy tapping */
    }

    /* Optimized icon size */
    .tts-btn svg {
        width: 12px;
        height: 12px;
    }

    .tts-icon-text {
        display: none;
    }

    /* Optimize input field for mobile */
    #userInput {
        font-size: 16px !important;      /* Prevent iOS zoom */
        line-height: 1.5;
        padding: 12px 16px !important;   /* Easier to tap/click */
        border-radius: 12px !important;
        min-height: 44px !important;     /* Apple recommended touch target */
        max-height: 120px !important;
    }

    /* Smooth scroll behavior */
    .chat-history,
    html,
    body {
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        scroll-behavior: smooth;
    }

    /* Better focus styling for inputs */
    #userInput:focus {
        outline: none;
        border-color: var(--accent-pink) !important;
        box-shadow: 0 0 0 3px rgba(255, 0, 128, 0.3) !important;
        background: rgba(255, 255, 255, 0.1) !important;
    }

    /* Improve registration form for mobile */
    .form-group input,
    .form-group select {
        font-size: 16px !important;      /* Prevent iOS zoom */
        padding: 14px 16px !important;
        min-height: 48px !important;     /* Comfortable tap target */
        border-radius: 12px !important;
    }

    .submit-btn {
        min-height: 48px !important;
        font-size: 1rem !important;
        padding: 14px 24px !important;
        border-radius: 12px !important;
    }

    /* Disable zoom on input fields */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
}

/* Tablet specific optimizations */
@media (min-width: 481px) and (max-width: 768px) {
    .main-container {
        padding-bottom: 70px; /* Space for keyboard */
    }

    .input-section {
        padding-bottom: 10px;
    }

    #userInput {
        font-size: 16px !important;
        min-height: 44px !important;
    }

    .send-btn {
        width: 52px !important;
        height: 52px !important;
    }
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-tertiary);
    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;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* ============================================
   INPUT SECTION
   ============================================ */
.input-section {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.input-wrapper {
    position: relative;
    width: 100%;
    padding: 20px;
}

.label {
    position: absolute;
    top: -35px;
    left: 30px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.input-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 12px 16px;
}

.input-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.input-icon svg {
    width: 24px;
    height: 24px;
    color: var(--text-tertiary);
    transition: color var(--transition-medium);
}

.input-container:focus-within .input-icon svg {
    color: var(--accent-blue);
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 300;
    font-family: 'Inter', sans-serif;
    resize: none;
    min-height: 24px;
    max-height: 200px;
    padding: 8px 4px;
    line-height: 1.5;
}

textarea::placeholder {
    color: var(--text-tertiary);
}

.send-btn {
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-medium);
    box-shadow: 0 4px 15px rgba(255, 0, 128, 0.3);
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.1) rotate(-10deg);
    box-shadow: 0 8px 25px rgba(255, 0, 128, 0.4);
}

.send-btn:active {
    transform: scale(1.05) rotate(-5deg);
}

.send-btn svg {
    width: 24px;
    height: 24px;
}

.input-hint {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-top: 12px;
}

/* ============================================
   INFO SECTION
   ============================================ */
.info-section {
    margin-top: 60px;
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.info-card {
    padding: 32px;
    text-align: center;
    transition: all var(--transition-slow);
}

.info-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-glow);
}

.info-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.info-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.info-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    margin-top: 60px;
    text-align: center;
    padding: 40px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer p {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.footer .disclaimer {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Heart Pulse Animation */
.heart-pulse {
    display: inline-block;
    animation: heartBeat 0.6s ease-in-out infinite;
    transform-origin: center;
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.3);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.3);
    }
    70% {
        transform: scale(1);
    }
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.loader {
    text-align: center;
    background: transparent;
    padding: 40px;
    border-radius: 24px;
    max-width: 400px;
}

.loader-gif {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    display: block;
    animation: spin 1s linear infinite;
    transition: animation-duration 0.3s ease;
    filter: drop-shadow(0 0 20px rgba(121, 40, 202, 0.5));
}

/* Spinning speed classes */
.loader-gif.speed-slow {
    animation-duration: 2s;
}

.loader-gif.speed-medium {
    animation-duration: 0.6s;
}

.loader-gif.speed-fast {
    animation-duration: 0.3s;
}

.loader-gif.speed-superfast {
    animation-duration: 0.15s;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loader-text {
    margin-top: 24px;
    font-size: 1.1rem;
    color: #ffffff;
    font-weight: 500;
    animation: pulse 1.5s ease-in-out infinite;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    background: transparent !important;
    -webkit-text-stroke: 0;
    letter-spacing: 0.5px;
}

.loader-note {
    margin-top: 16px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 300;
    font-style: italic;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
    background: transparent !important;
    -webkit-text-stroke: 0;
    line-height: 1.5;
    max-width: 350px;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
}

/* ============================================
   PWA INSTALL POPUP
   ============================================ */
.pwa-install-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 2500;
    display: none;
    justify-content: center;
    padding: 16px;
    pointer-events: none;
}

.pwa-install-overlay.active {
    display: flex;
}

.pwa-install-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 10px 14px 10px 10px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(121, 40, 202, 0.15);
    animation: slideUpBottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
}

@keyframes slideUpBottom {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDownBottom {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(100%);
    }
}

.pwa-install-overlay.hiding .pwa-install-card {
    animation: slideDownBottom 0.4s ease-in forwards;
}

.pwa-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(255, 0, 128, 0.25);
}

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

.pwa-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 1;
    min-width: 0;
}

.pwa-download-icon {
    width: 16px;
    height: 16px;
    color: #ffffff;
    flex-shrink: 0;
    animation: downloadBounce 2s ease-in-out infinite;
}

@keyframes downloadBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(2px); }
}

.pwa-badge span {
    font-size: 0.75rem;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
}

.pwa-install-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
    border: none;
    color: white;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(255, 0, 128, 0.3);
    flex-shrink: 0;
}

.pwa-install-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 0, 128, 0.4);
}

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

.pwa-install-btn svg {
    width: 14px;
    height: 14px;
}

.pwa-close-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-tertiary);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.pwa-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.pwa-close-btn svg {
    width: 12px;
    height: 12px;
}

/* ============================================
   RESPONSIVE - MOBILE OPTIMIZED
   ============================================ */
@media (max-width: 768px) {
    .logo {
        flex-direction: column;
        gap: 12px;
    }

    .logo-image {
        width: 56px;
        height: 56px;
    }

    .logo-text h1 {
        font-size: 1.75rem;
    }

    .main-container {
        padding: 20px 12px;
    }

    .welcome-card {
        padding: 32px 24px;
    }

    .welcome-icon {
        font-size: 4rem;
    }

    .features {
        grid-template-columns: repeat(2, 1fr);
    }

    .message-content {
        max-width: 90%;
        
        /* MOBILE OPTIMIZATION */
        min-height: 60px;       /* Minimum comfortable height */
        padding: 12px 16px;     /* Slightly smaller padding */
    }

    /* AI message mobile optimized */
    .message.ai .message-content {
        max-height: 280px;      /* Slightly lower for mobile */
        font-size: 0.95rem;     /* Larger text for readability */
    }

    /* Better tap targets */
    .send-btn {
        width: 48px;
        height: 48px;
    }

    /* Input container tetap inline, tidak wrap */
    .input-container {
        flex-wrap: nowrap;
        padding: 10px 12px;
    }

    /* Send button tetap di kanan, tidak full width */
    .send-btn {
        width: 48px;
        height: 48px;
        flex-shrink: 0;
        order: 0;
    }

    /* Textarea tetap flex */
    .input-container textarea {
        min-height: 20px;
        font-size: 0.95rem;     /* Mobile-friendly font */
    }
}

@media (max-width: 480px) {
    .logo-image {
        width: 48px;
        height: 48px;
    }

    .logo-text h1 {
        font-size: 1.5rem;
    }

    .welcome-card h2 {
        font-size: 1.5rem;
    }

    .features {
        grid-template-columns: 1fr;
    }

    /* Mobile ultra-optimized */
    .main-container {
        padding: 16px 10px;     /* Tighter padding */
    }

    .message-content {
        max-width: 92%;         /* Wider bubble */
        min-height: 56px;       /* Even more compact */
        padding: 10px 14px;     /* Reduced padding */
        font-size: 0.95rem;     /* Consistent font */
    }

    /* AI message ultra-mobile */
    .message.ai .message-content {
        max-height: 260px;      /* Shorter for tiny screens */
        font-size: 0.95rem;     /* Readable text */
        padding: 10px 14px;     /* Match parent */
    }

    /* Input container tetap inline di layar kecil */
    .input-container {
        flex-wrap: nowrap;
        padding: 8px 10px;
    }

    /* Send button tetap 48px di kanan */
    .send-btn {
        width: 48px;
        height: 48px;
        flex-shrink: 0;
        order: 0;
    }

    /* Textarea menyesuaikan sisa ruang */
    .input-container textarea {
        min-height: 20px;
        font-size: 0.9rem;      /* Smaller but readable */
    }

    .label {
        font-size: 0.65rem;     /* Compact label */
        letter-spacing: 2px;
    }

    /* Footer text smaller */
    .footer {
        font-size: 0.75rem;     /* Compact footer */
    }

    /* Modal optimized */
    .modal-container {
        padding: 24px 16px;     /* Tighter modal padding */
    }

    .heart {
        font-size: 1.75rem;     /* Smaller hearts */
    }
}

/* ============================================
   MODAL STYLES
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.modal-container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 40px rgba(121, 40, 202, 0.2);
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    text-align: center;
    margin-bottom: 32px;
}

.modal-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, rgba(255, 255, 255, 0.7));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.modal-header p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.modal-body {
    animation: fadeIn 0.5s ease-out 0.2s both;
}

/* Registration Form */
.registration-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-group input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: all var(--transition-fast);
}

.form-group input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(121, 40, 202, 0.1);
    outline: none;
}

.form-group input:hover {
    border-color: rgba(121, 40, 202, 0.5);
}

.form-group select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: all var(--transition-fast);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-group select:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(121, 40, 202, 0.1);
    outline: none;
}

.form-group select:hover {
    border-color: rgba(121, 40, 202, 0.5);
}

/* Custom Tooltip Styling */
.form-group input[title]:hover,
.form-group select[title]:hover {
    position: relative;
}

.form-group input[title]:hover::after,
.form-group select[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(121, 40, 202, 0.4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.form-group input[title]:hover::after,
.form-group select[title]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-12px);
}

.form-group select option {
    background: #1a1a1a;
    color: #ffffff;
    padding: 12px;
    font-size: 1rem;
}

.form-group select option:hover,
.form-group select option:checked {
    background: #7928ca;
    color: #ffffff;
}

.form-group select:focus option {
    background: #1a1a1a;
}

.form-group select:focus option:hover,
.form-group select:focus option:checked {
    background: #7928ca;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-purple);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 20px rgba(121, 40, 202, 0.3);
}

.form-group input::placeholder {
    color: var(--text-tertiary);
}

.submit-btn {
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
    border: none;
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all var(--transition-medium);
    box-shadow: 0 4px 15px rgba(255, 0, 128, 0.3);
    margin-top: 8px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 0, 128, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn svg {
    width: 20px;
    height: 20px;
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Rating Container */
.rating-container {
    text-align: center;
}

.rating-hearts {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 24px 0;
}

.heart {
    font-size: 3rem;
    cursor: pointer;
    transition: all var(--transition-medium);
    filter: grayscale(0.3);
    user-select: none;
    -webkit-user-select: none;
}

.heart:hover {
    transform: scale(1.3);
    filter: brightness(1.2);
}

.rating-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 16px;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-container {
        padding: 32px 24px;
        max-width: 100%;
    }

    .modal-header h2 {
        font-size: 1.5rem;
    }

    .heart {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .modal-overlay {
        padding: 16px;
    }

    .modal-container {
        padding: 24px 20px;
    }

    .heart {
        font-size: 2rem;
    }

    .rating-hearts {
        gap: 8px;
    }

    .pwa-install-card {
        max-width: 100%;
        padding: 8px 12px 8px 8px;
    }

    .pwa-icon {
        width: 36px;
        height: 36px;
    }

    .pwa-badge span {
        font-size: 0.7rem;
    }

    .pwa-install-btn {
        padding: 7px 12px;
        font-size: 0.75rem;
    }
}
