/* ============================================================
   INSTANT AI TAB - PREMIUM STYLING
   Dark Theme with Gradients, Glass Morphism, and Gold Accents
   Matching the Purchased Tours visual design
   ============================================================ */

/* Welcome Screen */
.instant-ai-welcome {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: linear-gradient(180deg, #0a0a0c 0%, #000000 100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.instant-ai-header {
    padding: 16px 20px;
    background: linear-gradient(180deg, rgba(10, 10, 12, 0.98) 0%, rgba(0, 0, 0, 0.95) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 10;
}

.instant-ai-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    padding: 8px 0;
    background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.85) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.instant-ai-welcome-content {
    flex: 1;
    padding: 32px 20px;
    overflow-y: auto;
}

.welcome-title-section {
    margin-bottom: 28px;
    text-align: center;
}

.welcome-title-section h2 {
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 12px 0;
    background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.9) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    line-height: 1.6;
}

/* Start Button - Blue Style */
.start-ai-button {
    width: 100%;
    padding: 18px 24px;
    margin: 24px 0;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #0066FF 0%, #0052CC 100%);
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(0, 102, 255, 0.3), 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.start-ai-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.start-ai-button:hover::before {
    left: 100%;
}

.start-ai-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 102, 255, 0.4), 0 6px 16px rgba(0, 0, 0, 0.4);
}

.start-ai-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.25), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.button-icon {
    flex-shrink: 0;
    transition: transform 0.3s ease;
    stroke: #ffffff;
}

.start-ai-button:hover .button-icon {
    transform: translateX(3px);
}

/* Pro Tip Box - Info Card Style */
.pro-tip-box {
    display: flex;
    gap: 14px;
    padding: 18px;
    margin: 24px 0;
    border-radius: 16px;
    background: rgba(0, 102, 255, 0.06);
    border: 1px solid rgba(0, 102, 255, 0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.pro-tip-box:hover {
    border-color: rgba(0, 102, 255, 0.3);
    background: rgba(0, 102, 255, 0.1);
}

.pro-tip-icon {
    flex-shrink: 0;
    color: #0066FF;
    filter: drop-shadow(0 0 4px rgba(0, 102, 255, 0.3));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.pro-tip-box:hover .pro-tip-icon {
    transform: rotate(-15deg) scale(1.1);
    filter: drop-shadow(0 0 10px rgba(0, 102, 255, 0.5));
}

.pro-tip-box p {
    margin: 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

.pro-tip-box strong {
    color: #0066FF;
    font-weight: 600;
}

/* Topics Section */
.topics-section {
    margin-top: 32px;
}

.topics-header {
    font-size: 18px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 16px 0;
    text-align: left;
}

.topics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

/* Topic Cards - Premium Glass Style */
.topic-card {
    padding: 20px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.topic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 102, 255, 0.4), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.topic-card:hover::before {
    opacity: 1;
}

.topic-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.topic-card:active {
    transform: scale(0.98) translateY(-2px);
}

.topic-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 14px;
    color: #0066FF;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 102, 255, 0.2));
}

.topic-card:hover .topic-icon {
    transform: translateY(-6px) scale(1.1);
    filter: drop-shadow(0 8px 16px rgba(0, 102, 255, 0.3));
}

.topic-title {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    margin: 0 0 6px 0;
}

.topic-description {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
    line-height: 1.4;
}

.topics-footer {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    margin: 0;
    padding-top: 8px;
}

/* ============================================================
   CHAT SCREEN
   ============================================================ */

.instant-ai-chat {
    display: none;
    flex-direction: column;
    height: calc(100vh - 90px);
    background: linear-gradient(180deg, #0a0a0c 0%, #000000 100%);
    width: 100%;
    overflow: visible;
    position: relative;
}

.instant-ai-chat[style*="display: flex"] {
    display: flex !important;
}

.instant-ai-header-chat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(180deg, rgba(10, 10, 12, 0.98) 0%, rgba(0, 0, 0, 0.95) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 60px;
}

.instant-ai-header-chat h1 {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.85) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* Credits Display - Premium Badge */
.credits-display-header {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.12) 0%, rgba(255, 165, 0, 0.06) 100%);
    border: 1px solid rgba(255, 215, 0, 0.25);
    white-space: nowrap;
}

.credits-display-header .credits-amount {
    color: #FFD700;
    font-size: 14px;
    font-weight: 700;
}

.credits-display-header .credits-label {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    font-size: 12px;
}

.instant-ai-credits {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.12) 0%, rgba(255, 165, 0, 0.06) 100%);
    border: 1px solid rgba(255, 215, 0, 0.25);
    color: #FFD700;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.instant-ai-credits .credits-label {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    font-size: 11px;
}

.instant-ai-credits.low-credits {
    background: linear-gradient(135deg, rgba(255, 77, 77, 0.15) 0%, rgba(255, 77, 77, 0.08) 100%);
    border-color: rgba(255, 77, 77, 0.4);
    color: #ff8a8a;
}

/* Close Button - Premium Style */
.close-chat-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.close-chat-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    /* Extra bottom padding to account for fixed input-section height (~90px) */
    padding-bottom: 100px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

.message-bubble {
    display: flex;
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease-in;
}

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

.message-bubble.ai {
    justify-content: flex-start;
}

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

.bubble-content {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 18px;
    word-wrap: break-word;
    font-size: 15px;
    line-height: 1.55;
}

/* User Message Bubble - Blue Accent */
.message-bubble.user .bubble-content {
    background: linear-gradient(135deg, #0066FF 0%, #0052CC 100%);
    color: #ffffff;
    border-radius: 18px 18px 4px 18px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.25);
}

/* AI Message Bubble - Glass Style */
.message-bubble.ai .bubble-content {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.95);
    border-radius: 18px 18px 18px 4px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Loading Dots */
.loading-dots {
    display: flex;
    gap: 5px;
    padding: 14px 18px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0066FF;
    animation: bounce 1.4s infinite;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        opacity: 0.4;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-8px);
    }
}

/* Input Section */
.input-section {
    padding: 12px 16px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(5, 5, 6, 0.98) 0%, rgba(0, 0, 0, 1) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    position: fixed;
    bottom: 83px;
    left: 0;
    right: 0;
    z-index: 1000;
    flex-shrink: 0;
}

.input-bar {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    position: relative;
}

.message-textarea {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.04);
    color: #ffffff;
    font-size: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    resize: none;
    max-height: 100px;
    min-height: 44px;
    height: 44px;
    outline: none;
    transition: all 0.3s ease;
    overflow: hidden;
    line-height: 1.3;
}

.message-textarea:focus {
    border-color: rgba(0, 102, 255, 0.5);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.message-textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Textarea during recording */
.message-textarea.recording {
    border-color: rgba(255, 107, 107, 0.5) !important;
    background: rgba(255, 107, 107, 0.05) !important;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1) !important;
}

/* Placeholder during recording */
.message-textarea.recording::placeholder {
    color: rgba(255, 107, 107, 0.7);
}

/* Image Preview */
.image-preview {
    position: absolute;
    bottom: 76px;
    left: 20px;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(255, 215, 0, 0.3);
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: slideUp 0.3s ease;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

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

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-image-btn:hover {
    background: rgba(255, 77, 77, 0.3);
    border-color: rgba(255, 77, 77, 0.5);
}

/* Icon Buttons - Premium Glass Style */
.icon-button {
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.6);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.icon-button svg {
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.icon-button:hover .camera-icon,
.icon-button:hover .mic-icon,
.icon-button:hover .send-icon {
    transform: scale(1.1);
}

.icon-button:active {
    transform: scale(0.95);
}

/* Microphone Button Recording State - Red Pulse */
.mic-button.recording {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.25) 0%, rgba(255, 80, 80, 0.2) 100%);
    border-color: rgba(255, 107, 107, 0.5);
    color: #FF6B6B;
    animation: pulse-recording 1.5s infinite;
}

.mic-button.recording .mic-icon {
    animation: mic-pulse 0.8s ease-in-out infinite;
}

@keyframes pulse-recording {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(255, 107, 107, 0.15);
    }
}

@keyframes mic-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

/* Send Button - Blue */
.send-button {
    background: linear-gradient(135deg, #0066FF 0%, #0052CC 100%);
    border: none;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

.send-button:hover {
    background: linear-gradient(135deg, #1a75ff 0%, #0066FF 100%);
    box-shadow: 0 6px 16px rgba(0, 102, 255, 0.4);
    border: none;
}

.send-button:hover .send-icon {
    transform: scale(1.1) translateX(2px);
    stroke: #ffffff;
}

.send-button:disabled {
    background: rgba(255, 255, 255, 0.08);
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    color: rgba(255, 255, 255, 0.4);
}

.send-button:disabled .send-icon {
    transform: none;
    stroke: currentColor;
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

@media (max-width: 600px) {
    .instant-ai-welcome-content {
        padding: 24px 16px;
    }

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

    .topic-card {
        min-height: 120px;
        padding: 16px 12px;
    }

    .topic-icon {
        width: 40px;
        height: 40px;
    }

    .message-bubble {
        margin-bottom: 6px;
    }

    .bubble-content {
        max-width: 85%;
        font-size: 14px;
        padding: 12px 16px;
    }

    .input-section {
        padding: 10px 12px;
        padding-bottom: calc(6px + env(safe-area-inset-bottom));
    }

    .icon-button {
        width: 44px;
        height: 44px;
    }

    .icon-button svg {
        width: 20px;
        height: 20px;
    }

    .message-textarea {
        min-height: 40px;
        height: 40px;
        padding: 10px 14px;
    }
}

@media (max-width: 400px) {
    .instant-ai-header h1,
    .instant-ai-header-chat h1 {
        font-size: 22px;
    }

    .welcome-title-section h2 {
        font-size: 22px;
    }

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

    .topic-card {
        min-height: auto;
        padding: 18px 16px;
        flex-direction: row;
        text-align: left;
        gap: 16px;
    }

    .topic-icon {
        margin-bottom: 0;
    }

    .topic-card:hover .topic-icon {
        transform: scale(1.1);
    }

    .message-bubble {
        margin-bottom: 4px;
    }

    .bubble-content {
        max-width: 90%;
        font-size: 13px;
    }

    .start-ai-button {
        font-size: 16px;
        padding: 16px 20px;
    }
}

/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */

.instant-ai-welcome::-webkit-scrollbar,
.messages-container::-webkit-scrollbar {
    width: 6px;
}

.instant-ai-welcome::-webkit-scrollbar-track,
.messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.instant-ai-welcome::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb {
    background: rgba(0, 102, 255, 0.3);
    border-radius: 3px;
}

.instant-ai-welcome::-webkit-scrollbar-thumb:hover,
.messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 102, 255, 0.5);
}
