/* ===== BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(to bottom, #fff3f5, #eae6ff);
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* ===== BACKGROUND DECORATIONS ===== */
.bg-decoration-1 {
    position: absolute;
    width: 249px;
    height: 249px;
    top: 685px;
    right: -75px;
    background: radial-gradient(circle, rgba(249, 218, 145, 0.7) 0%, transparent 70%);
    filter: blur(127px);
    pointer-events: none;
}

.bg-decoration-2 {
    position: absolute;
    width: 289px;
    height: 289px;
    top: 348px;
    left: -152px;
    background: radial-gradient(circle, rgba(124, 112, 255, 0.21) 0%, transparent 70%);
    filter: blur(127px);
    pointer-events: none;
}

/* ===== HEADER ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background: #7c70ff;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
}

.home-btn {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    color: white;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.home-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.05);
}

.home-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.home-btn .icon {
    width: 18px;
    height: 18px;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    color: white;
    z-index: 20;
}

/* ===== CONTROLS SECTION ===== */
.controls {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 24px;
    width: 100%;
    margin-bottom: 16px;
    z-index: 10;
}

.control-group {
    display: flex;
    gap: 16px;
    align-items: center;
}

.control-item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.control-label {
    font-size: 14px;
    color: #333333;
    font-weight: 400;
}

.control-select {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 8px 16px;
    width: 231px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    color: black;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.control-select:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.2);
}

.control-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-top: 2px;
    display: none;
    animation: dropdownFadeIn 0.2s ease;
}

.dropdown-menu.show {
    display: block;
}

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

.dropdown-item {
    padding: 8px 16px;
    font-size: 14px;
    color: black;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background: rgba(124, 112, 255, 0.1);
}

.dropdown-item:first-child {
    border-radius: 7px 7px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 7px 7px;
}

.reset-btn {
    display: flex;
    gap: 4px;
    align-items: center;
    font-size: 14px;
    color: #333333;
    background: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.reset-btn:hover {
    opacity: 0.7;
}

.reset-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 50px - 200px);
    padding-top: 50px;
}

.main-content.chat-active {
    align-items: stretch;
    text-align: left;
}

/* ===== WELCOME SCREEN ===== */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.welcome-title {
    font-size: 48px;
    font-weight: 700;
    background: linear-gradient(to right, #7c70ff, #ff6b9d, #4facfe);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
}

.welcome-subtitle {
    font-size: 18px;
    color: #333333;
    max-width: 700px;
    line-height: 1.6;
}
.welcome-subtitle-small {
    font-size: 14px;
    color: #666666;
    max-width: 700px;
    line-height: 1.5;
    margin-top: 16px;
    opacity: 0.8;
}

/* ===== CHAT AREA ===== */
.chat-area {
    margin-top: 60px;
    padding: 16px 16px 220px 16px;
    height: calc(100vh - 50px - 180px);
    overflow-y: auto;
    width: 100%;
    align-items: stretch;
    display: none;
}

.chat-area.active {
    display: block;
}

.chat-message {
    display: flex;
    margin-bottom: 16px;
    width: 100%;
    animation: messageSlideIn 0.3s ease;
}

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

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

.chat-message.ai {
    justify-content: flex-start;
    padding-left: 10px;
}

.message-bubble {
    max-width: 90%;
    border-radius: 16px;
    padding: 20px 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
}

.message-bubble.user {
    background: #7c70ff;
    color: white;
}

.message-bubble.ai {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: black;
}

.message-text {
    font-size: 15px;
    line-height: 1.7;
    word-wrap: break-word;
    overflow-wrap: break-word;
    /* white-space: pre-wrap; */
}

.message-timestamp {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.7;
}

/* ===== LOADING INDICATORS ===== */
.loading-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(124, 112, 255, 0.2);
    border-radius: 16px;
    max-width: 280px;
    margin: 16px 0 16px 20px;
    animation: messageSlideIn 0.3s ease;
    box-shadow: 0 2px 12px rgba(124, 112, 255, 0.1);
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(124, 112, 255, 0.3);
    border-top: 2px solid #7c70ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 14px;
    color: #7c70ff;
    font-weight: 500;
    font-style: normal;
}

/* ===== STREAMING MESSAGE ===== */
.streaming-message {
    position: relative;
}

.streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: #7c70ff;
    margin-left: 2px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ===== BOTTOM SECTION ===== */
.bottom-section {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 1200px;
    max-width: calc(100% - 72px);
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 500;
    padding: 20px 0;
}

/* Reduce gap when chat is active */
.main-content.chat-active ~ .bottom-section {
    gap: 12px;
    bottom: 10px;
    padding: 15px 0;
}

/* Alternative: Body class approach for chat active state */
body.chat-active .bottom-section {
    gap: 12px;
    bottom: 10px;
    padding: 15px 0;
}

/* ===== SUGGESTION CARDS (Welcome Screen) ===== */
.suggestions {
    display: flex;
    gap: 12px;
    width: 100%;
}

.suggestion-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.suggestion-card:hover {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(0, 0, 0, 0.15);
    transform: scale(1.02);
}

.suggestion-card:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.suggestion-card.loading {
    pointer-events: none;
}

.suggestion-title {
    font-size: 14px;
    font-weight: 600;
    color: black;
    margin-bottom: 8px;
}

.suggestion-description {
    font-size: 12px;
    color: #333333;
    line-height: 1.3;
}

/* ===== IN-CHAT FOLLOW-UP QUESTIONS ===== */
.chat-followup-questions {
    margin: 16px 0;
    padding: 16px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(124, 112, 255, 0.2);
    border-radius: 12px;
    max-width: 90%;
    margin-left: 10px;
}

.chat-followup-title {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-followup-title::before {
    content: "💡";
    font-size: 14px;
}

.chat-followup-question {
    display: block;
    background: none;
    border: none;
    padding: 8px 12px;
    margin: 4px 0;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 8px;
    text-align: left;
    width: 100%;
    font-size: 13px;
    color: #7c70ff;
    text-decoration: none;
    border: 1px solid transparent;
    line-height: 1.4;
}

.chat-followup-question:hover {
    background: rgba(124, 112, 255, 0.1);
    border-color: rgba(124, 112, 255, 0.3);
    color: #6b5ce6;
}

.chat-followup-question::before {
    content: "→";
    margin-right: 8px;
    font-weight: bold;
    transition: transform 0.2s;
}

.chat-followup-question:hover::before {
    transform: translateX(2px);
}

/* ===== INPUT AREA ===== */
.input-area {
    background: rgba(242, 242, 242, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    height: 93px;
    transition: all 0.2s ease;
}

.input-area.loading {
    opacity: 0.7;
    pointer-events: none;
}

.input-textarea {
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    width: 100%;
    flex: 1;
    font-size: 16px;
    color: black;
    font-family: 'Inter', sans-serif;
}

.input-textarea::placeholder {
    color: rgba(0, 0, 0, 0.5);
}

.input-textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.input-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.mic-btn {
    width: 22px;
    height: 22px;
    cursor: pointer;
    transition: opacity 0.2s;
    background: none;
    border: none;
    padding: 0;
}

.mic-btn:hover {
    opacity: 0.7;
}

.mic-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.send-btn {
    background: #1e1e1e;
    border: none;
    border-radius: 17px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.send-btn:hover:not(:disabled) {
    background: #2a2a2a;
    transform: scale(1.05);
}

.send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.send-btn.loading {
    background: #7c70ff;
}

.send-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== ICONS ===== */
.icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.icon-white {
    fill: white;
}

/* ===== TABLE STYLING ===== */
.message-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-text table th {
    background: linear-gradient(135deg, #7c70ff, #6b5ce6);
    color: white;
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
    font-size: 14px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.message-text table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 14px;
    line-height: 1.5;
}

.message-text table tr:nth-child(even) td {
    background: rgba(124, 112, 255, 0.05);
}

.message-text table tr:hover td {
    background: rgba(124, 112, 255, 0.1);
    transition: background-color 0.2s ease;
}

.message-text table tr:last-child td {
    border-bottom: none;
}

/* Responsive table wrapper */
.table-responsive {
    overflow-x: auto;
    margin: 16px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #7c70ff;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #6b5ce6;
}

/* Enhanced table container */
.enhanced-table-container {
    margin: 20px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.table-meta {
    background: linear-gradient(135deg, #f8f9ff, #f0f2ff);
    padding: 12px 16px;
    border-bottom: 1px solid rgba(124, 112, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-icon {
    font-size: 16px;
}

.table-label {
    font-size: 13px;
    font-weight: 600;
    color: #7c70ff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.3s ease;
}

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

/* ===== PROGRESS INDICATORS ===== */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(124, 112, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c70ff, #ff6b9d);
    border-radius: 2px;
    transition: width 0.3s ease;
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* ===== ERROR STATES ===== */
.error-message {
    background: rgba(255, 99, 99, 0.1);
    border: 1px solid rgba(255, 99, 99, 0.3);
    color: #d32f2f;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 8px 0;
    font-size: 14px;
    animation: errorShake 0.5s ease;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ===== SUCCESS STATES ===== */
.success-message {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #2e7d32;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 8px 0;
    font-size: 14px;
    animation: successPulse 0.5s ease;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1280px) {
    .main-content, .bottom-section {
        width: calc(100% - 48px);
        max-width: calc(100% - 48px);
    }
    
    .suggestions {
        flex-direction: column;
    }
    
    .welcome-title {
        font-size: 36px;
    }
    
    .welcome-subtitle {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        gap: 12px;
        align-items: center;
    }
    
    .control-group {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
    
    .control-select {
        width: 200px;
    }
    
    .welcome-title {
        font-size: 28px;
    }
    
    .bottom-section {
        bottom: 10px;
        padding: 10px 0;
    }
    
    .message-bubble {
        max-width: 95%;
        padding: 16px 18px;
    }
    
    .chat-area {
        padding: 16px 8px 240px 8px;
    }
    
    .home-btn {
        left: 10px;
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .home-btn .icon {
        width: 16px;
        height: 16px;
    }
    
    .header-title {
        font-size: 18px;
    }
    
    /* Mobile table improvements */
    .message-text table {
        font-size: 12px;
    }
    
    .message-text table th,
    .message-text table td {
        padding: 8px 12px;
    }
    
    .table-responsive {
        margin: 12px 0;
    }
    
    .enhanced-table-container {
        margin: 16px 0;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== DARK MODE SUPPORT (Future Enhancement) ===== */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here in the future */
}

/* ===== PRINT STYLES ===== */
@media print {
    .controls, .bottom-section, .header {
        display: none;
    }
    
    .main-content {
        position: static;
        transform: none;
        width: 100%;
        height: auto;
    }
    
    .chat-area {
        display: block;
        height: auto;
        overflow: visible;
    }
}
