/* Wx Horizon Weather Chatbot Styles - Header Compressed */

:root {
    --primary-color: #0066cc;
    --secondary-color: #003d7a;
    --accent-color: #0080ff;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --dark-gray: #495057;
    --text-color: #212529;
    --border-radius: 8px;
    --box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: var(--text-color);
}

/* COMPRESSED Navigation Bar */
.vaisala-navbar {
    background: white;
    box-shadow: var(--box-shadow);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.vaisala-navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.25rem 2rem;
}

.vaisala-navbar-left {
    display: flex;
    align-items: center;
}
.vaisala-navbar-middle {
    display: flex;
    align-items: center;
}

.vaisala-logo {
    height: 60px;
    width: auto;
}
.chatbot-logo {
    height: 80px;
    width: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-color);
}

.user-info span {
    padding: 0.4rem 0.75rem;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    font-weight: 500;
    border: 1px solid var(--medium-gray);
}

.logout-btn {
    background: var(--danger-color);
    color: white;
    text-decoration: none;
    padding: 0.4rem 0.4rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
}

.logout-btn:hover {
    background: #c82333;
}

/* COMPRESSED Chat Header */
.chat-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 0.75rem;
    text-align: center;
}

.chat-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.chat-header p {
    font-size: 14px;
    opacity: 0.9;
}

/* Responsive - Mobile Compression */
@media (max-width: 768px) {
    .vaisala-navbar-content {
        padding: 0.25rem;
    }
    
    .chat-header {
        padding: 0.5rem;
    }
    
    .chat-header h1 {
        font-size: 20px;
    }
}

/* Advanced Chat Interface Styles */
.main-content {
    padding: 0;
}

.chat-outer {
    max-width: 1000px;
    margin: 2rem auto;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
    display: block;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 80vh;
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    background: #fafbfc;
    scroll-behavior: smooth;
}

.chat-messages {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 100%;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* Chat messages container for JavaScript access */
#chatMessages {
    overflow-y: auto;
    scroll-behavior: smooth;
    max-height: 70vh;
    padding: 1rem;
}

.message {
    max-width: 80%;
    word-wrap: break-word;
    animation: slideIn 0.3s ease-out;
}

.user-message {
    align-self: flex-end;
}

.bot-message {
    align-self: flex-start;
}

.message-content {
    padding: 1rem 1.25rem;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.6;
    position: relative;
}

.user-message .message-content {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background: white;
    color: var(--text-color);
    border: 1px solid var(--medium-gray);
    border-bottom-left-radius: 4px;
    box-shadow: var(--box-shadow);
}

.bot-message .message-content ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.bot-message .message-content ul li {
    margin: 0.25rem 0;
}

.bot-message .message-content strong {
    color: var(--primary-color);
}

.feedback {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.feedback button {
    background: none;
    border: 1px solid var(--medium-gray);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback button:hover {
    background: var(--light-gray);
    transform: scale(1.1);
}

.feedback button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.feedback-thankyou {
    color: var(--success-color);
    font-size: 12px;
    font-weight: 500;
    margin-left: 0.5rem;
}

.chat-input {
    padding: 1.5rem 2rem;
    background: white;
    border-top: 1px solid var(--medium-gray);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.chat-input form {
    display: flex;
    gap: 1rem;
    align-items: center;
    width: 100%;
}

#messageInput {
    flex: 1;
    padding: 1rem 1.25rem;
    border: 2px solid var(--medium-gray);
    border-radius: 25px;
    font-size: 15px;
    outline: none;
    transition: var(--transition);
}

#messageInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

#messageInput::placeholder {
    color: #999;
}

#sendButton, #newChatButton {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
    top: 2px;
}

#sendButton {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    min-width: 80px;
}

#sendButton:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.3);
}

#sendButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#sendButton.loading {
    background: var(--medium-gray);
    color: var(--dark-gray);
}

#newChatButton {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

#newChatButton:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

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

/* Thinking Indicator Styles */
.thinking-indicator {
    opacity: 0.8;
}

.thinking-animation {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.thinking-text {
    font-style: italic;
    color: var(--dark-gray);
    font-weight: 500;
}

.thinking-dots {
    display: flex;
    gap: 4px;
}

.thinking-dots span {
    width: 6px;
    height: 6px;
    background-color: var(--primary-color);
    border-radius: 50%;
    animation: thinking-pulse 1.4s infinite both;
}

.thinking-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0s;
}

.thinking-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-step {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--medium-gray);
    transition: color 0.3s ease;
    padding: 4px 0;
}

.progress-step::before {
    content: "⏳";
    margin-right: 8px;
    transition: all 0.3s ease;
}

.progress-step.active {
    color: var(--primary-color);
    font-weight: 500;
}

.progress-step.active::before {
    content: "⚡";
    animation: progress-glow 1s ease-in-out infinite alternate;
}

@keyframes thinking-pulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes progress-glow {
    from {
        opacity: 0.7;
    }
    to {
        opacity: 1;
    }
}

/* Streaming Message Styles */
.streaming-message {
    position: relative;
}

.streaming-message::after {
    content: "▌";
    color: var(--primary-color);
    animation: cursor-blink 1s infinite;
    margin-left: 2px;
}

.streaming-text {
    display: inline;
}

.error-message {
    background-color: #ffebee !important;
    border-left: 4px solid var(--danger-color);
}

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

/* Auto-scroll indicator */
.scroll-indicator {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
    z-index: 1000;
    box-shadow: var(--box-shadow);
}

.scroll-indicator.show {
    opacity: 0.9;
}

.scroll-indicator:hover {
    opacity: 1;
    transform: scale(1.05);
}

/* Markdown Content Styling */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin: 1rem 0 0.5rem 0;
    font-weight: 600;
    color: var(--primary-color);
}

.message-content h1 { font-size: 1.5rem; }
.message-content h2 { font-size: 1.3rem; }
.message-content h3 { font-size: 1.2rem; }
.message-content h4 { font-size: 1.1rem; }
.message-content h5 { font-size: 1rem; }
.message-content h6 { font-size: 0.9rem; }

.message-content p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.message-content ul,
.message-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-content li {
    margin: 0.25rem 0;
    line-height: 1.5;
}

.message-content ul li {
    list-style-type: disc;
}

.message-content ol li {
    list-style-type: decimal;
}

.message-content code {
    background: var(--light-gray);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--primary-color);
    border: 1px solid var(--medium-gray);
}

.message-content pre {
    background: var(--light-gray);
    padding: 1rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin: 0.5rem 0;
    border: 1px solid var(--medium-gray);
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message-content pre code {
    background: none;
    padding: 0;
    border: none;
    font-size: inherit;
}

.message-content blockquote {
    border-left: 4px solid var(--primary-color);
    margin: 0.5rem 0;
    padding: 0.5rem 1rem;
    background: rgba(0, 102, 204, 0.05);
    font-style: italic;
    color: var(--dark-gray);
}

.message-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

.message-content a:hover {
    color: var(--secondary-color);
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5rem 0;
    border: 1px solid var(--medium-gray);
}

.message-content th,
.message-content td {
    border: 1px solid var(--medium-gray);
    padding: 0.5rem;
    text-align: left;
}

.message-content th {
    background: var(--light-gray);
    font-weight: 600;
    color: var(--primary-color);
}

.message-content hr {
    border: none;
    border-top: 2px solid var(--medium-gray);
    margin: 1rem 0;
}

/* Ensure first element in message has no top margin */
.message-content > *:first-child {
    margin-top: 0;
}

/* Ensure last element in message has no bottom margin */
.message-content > *:last-child {
    margin-bottom: 0;
}

/* Feedback Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease-out;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    animation: slideDown 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--medium-gray);
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.25rem;
}

.modal-close {
    color: var(--dark-gray);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger-color);
    transform: scale(1.1);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body p {
    margin-bottom: 1rem;
    color: var(--text-color);
    font-size: 0.95rem;
}

.modal-body textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 100px;
    outline: none;
    transition: var(--transition);
}

.modal-body textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.modal-body textarea::placeholder {
    color: #999;
}

.char-counter {
    text-align: right;
    font-size: 0.85rem;
    color: var(--dark-gray);
    margin-top: 0.5rem;
}

.char-counter.warning {
    color: var(--warning-color);
}

.char-counter.limit {
    color: var(--danger-color);
    font-weight: bold;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--medium-gray);
    background-color: var(--light-gray);
}

.modal-btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.modal-btn-cancel {
    background-color: white;
    color: var(--dark-gray);
    border: 1px solid var(--medium-gray);
}

.modal-btn-cancel:hover {
    background-color: var(--light-gray);
}

.modal-btn-submit {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
}

.modal-btn-submit:hover {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.3);
}

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

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

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

/* Mobile responsive modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
}
