/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: white;
    min-height: 100vh;
}

/* Background Image Container */
.background-image-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
    pointer-events: none;
}

.centered-logo {
    max-width: 60%;
    max-height: 60%;
    object-fit: contain;
    opacity: 0.8;
}

/* Chat Popup Styles */
.chat-popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

/* Hide the chat toggle button (chat icon) */
.chat-toggle {
    display: none !important;
}

/* Ensure chat window is always visible */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 40px;
    width: 320px;
    height: 400px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
}

.chat-window.open {
    display: flex;
}

.chat-header {
    background: #3F4345;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 15px 15px 0 0;
}

.chat-header h2 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Small Login Button */
.login-btn-small {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-btn-small:hover {
    background: rgba(255, 255, 255, 0.3);
}

.user-info {
    color: #f0f0f0;
    font-size: 0.8em;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    white-space: nowrap;
}

.logout-btn, .clear-button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.button-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
}

.logout-btn:hover, .clear-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Specific styling for logout button */
.logout-btn {
    background: rgba(255, 87, 87, 0.8) !important;
    margin-right: 5px;
    width: 45px !important;
    font-size: 9px !important;
    font-weight: bold;
    border-radius: 12px !important;
}

.logout-btn:hover {
    background: rgba(255, 87, 87, 1) !important;
    transform: scale(1.05);
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
}

.message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

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

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

.message p {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.9em;
    line-height: 1.4;
    word-wrap: break-word;
}

.message.user p {
    background: #3F4345;
    color: white;
    border-bottom-right-radius: 5px;
}

.message.bot p {
    background: white;
    color: #333;
    border: 1px solid #e1e5e9;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.message.loading p {
    background: #e9ecef;
    color: #6c757d;
    font-style: italic;
}

.chat-input-form {
    padding: 15px;
    background: white;
    border-top: 1px solid #e1e5e9;
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e1e5e9;
    border-radius: 20px;
    transition: border-color 0.3s ease;
    font-size: 0.9em;
}

.chat-input:focus {
    outline: none;
    border-color: #3F4345;
}

.chat-input:disabled {
    background: #f8f9fa;
    cursor: not-allowed;
}

#sendButton {
    background: #3F4345;
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    cursor: pointer;
    transition: transform 0.2s ease;
    white-space: nowrap;
}

#sendButton:hover:not(:disabled) {
    transform: translateY(-1px);
}

#sendButton:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Login Modal Styles */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.login-modal.show {
    display: flex;
}

.login-box {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 450px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.login-header {
    position: relative;
    margin-bottom: 20px;
}

.login-header-buttons {
    position: absolute;
    top: -10px;
    right: -10px;
    display: flex;
    gap: 8px;
}

.login-header h2 {
    color: #333;
    margin-bottom: 8px;
    font-size: 1.5em;
    font-weight: 600;
}

.login-header p {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.95em;
}

.clear-login-btn {
    background: #dc3545;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-login-btn:hover {
    background: #c82333;
}

.close-modal-btn {
    background: #6c757d;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.close-modal-btn:hover {
    background: #5a6268;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    color: #333;
    font-weight: 500;
    font-size: 0.9em;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 0.95em;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #3F4345;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group small {
    display: block;
    margin-top: 6px;
    color: #666;
    font-size: 0.85em;
}

.input-group small span {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: bold;
    color: #333;
}

.login-buttons {
    display: flex;
    gap: 8px;
    width: 100%;
}

.login-btn {
    background: #3F4345;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex: 2;
    margin-bottom: 12px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.cancel-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex: 1;
    margin-bottom: 12px;
}

.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(220, 53, 69, 0.3);
    background: #c82333;
}

.back-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.95em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
}

.back-btn:hover {
    background: #5a6268;
}

.login-info {
    margin-top: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: left;
}

.login-info p {
    color: #333;
    font-weight: 600;
    margin-bottom: 8px;
}

/* OTP Section Styles */
.otp-section {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    animation: slideDown 0.3s ease-out;
}

.otp-info {
    text-align: center;
    margin-bottom: 15px;
}

.otp-info p {
    color: #495057;
    font-size: 0.95em;
    margin-bottom: 8px;
    font-weight: 500;
}

.otp-display {
    background: #3F4345;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin: 12px 0;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.otp-display span {
    font-family: 'Courier New', monospace;
    font-size: 1.5em;
    font-weight: bold;
    letter-spacing: 2px;
}

.otp-info small {
    color: #6c757d;
    font-size: 0.85em;
    font-style: italic;
}

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

.login-info ul {
    list-style: none;
    padding: 0;
}

.login-info li {
    color: #666;
    padding: 4px 0;
    font-size: 0.85em;
    border-bottom: 1px solid #e9ecef;
}

.login-info li:last-child {
    border-bottom: none;
}

/* Responsive Design */
/* Large desktop screens */
@media (min-width: 1200px) {
    .chat-window {
        width: 380px;
        height: 450px;
    }
    
    .chat-header h2 {
        font-size: 1.3em;
    }
    
    .user-info {
        max-width: 180px;
        font-size: 0.9em;
    }
    
    .message p {
        font-size: 1em;
    }
    
    .chat-input {
        font-size: 1em;
    }
}

/* Tablets and small desktops */
@media (min-width: 768px) and (max-width: 1199px) {
    .chat-window {
        width: 350px;
        height: 420px;
    }
    
    .chat-header h2 {
        font-size: 1.2em;
    }
    
    .user-info {
        max-width: 150px;
        font-size: 0.85em;
    }
}

/* Mobile devices */
@media (max-width: 767px) {
    .chat-popup {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        bottom: auto;
        right: auto;
    }
    
    .chat-window {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        bottom: auto;
        right: auto;
        border-radius: 0;
        box-shadow: none;
    }
    
    .chat-header {
        padding: 12px;
    }
    
    .chat-header h2 {
        font-size: 1.1em;
    }
    
    .user-info {
        max-width: 100px;
        font-size: 0.75em;
    }
    
    .logout-btn {
        width: 40px !important;
        font-size: 8px !important;
    }
    
    .chat-messages {
        padding: 12px;
    }
    
    .message p {
        max-width: 90%;
        padding: 8px 12px;
        font-size: 0.85em;
    }
    
    .chat-input-form {
        padding: 12px;
        gap: 6px;
    }
    
    .chat-input {
        padding: 8px 12px;
        font-size: 0.85em;
    }
    
    #sendButton {
        padding: 8px 12px;
        font-size: 0.85em;
    }
    
    .login-box {
        padding: 20px;
        max-width: 95%;
        max-height: 90vh;
    }
    
    .login-header h2 {
        font-size: 1.3em;
    }
    
    .login-header p {
        font-size: 0.9em;
    }
    
    .input-group input {
        padding: 10px;
        font-size: 0.9em;
    }
    
    .login-btn, .cancel-btn {
        padding: 10px 15px;
        font-size: 0.9em;
    }
    
    .otp-display span {
        font-size: 1.3em;
        letter-spacing: 1px;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .chat-header h2 {
        font-size: 1em;
    }
    
    .user-info {
        max-width: 80px;
        font-size: 0.7em;
    }
    
    .message p {
        font-size: 0.8em;
    }
    
    .chat-input {
        font-size: 0.8em;
    }
    
    #sendButton {
        font-size: 0.8em;
    }
    
    .login-header h2 {
        font-size: 1.2em;
    }
    
    .login-header p {
        font-size: 0.85em;
    }
    
    .input-group label {
        font-size: 0.85em;
    }
    
    .input-group input {
        font-size: 0.85em;
    }
    
    .otp-display span {
        font-size: 1.2em;
    }
    
    .otp-info p {
        font-size: 0.9em;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .chat-header {
        padding: 10px;
    }
    
    .chat-header h2 {
        font-size: 0.9em;
    }
    
    .user-info {
        max-width: 70px;
        font-size: 0.65em;
    }
    
    .message p {
        font-size: 0.75em;
        padding: 6px 10px;
    }
    
    .chat-input {
        padding: 6px 10px;
        font-size: 0.75em;
    }
    
    #sendButton {
        padding: 6px 10px;
        font-size: 0.75em;
    }
    
    .login-header h2 {
        font-size: 1.1em;
    }
    
    .login-btn, .cancel-btn {
        padding: 8px 12px;
        font-size: 0.8em;
    }
}

/* Pensioner Info Display */
.pensioner-info {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 10px;
    padding: 15px;
    margin: 12px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.pensioner-info h3 {
    color: #333;
    margin-bottom: 12px;
    font-size: 1.1em;
    border-bottom: 2px solid #3F4345;
    padding-bottom: 6px;
}

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

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-weight: 600;
    color: #666;
    font-size: 0.8em;
    margin-bottom: 4px;
}

.info-value {
    color: #333;
    font-size: 0.9em;
}

.pension-details {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-top: 12px;
}

.pension-details h4 {
    color: #333;
    margin-bottom: 8px;
    font-size: 1em;
}

.pension-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* FAQ Display */
.faq-item {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.faq-item:hover {
    border-color: #3F4345;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.faq-question {
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    font-size: 0.9em;
}

.faq-answer {
    color: #666;
    font-size: 0.85em;
    line-height: 1.5;
    display: none;
}

.faq-item.expanded .faq-answer {
    display: block;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e9ecef;
}

/* Action buttons in chat */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.action-btn {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85em;
}

.action-btn:hover {
    border-color: #3F4345;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

/* Login button in chat messages */
.login-btn {
    background: #3F4345;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin: 8px 0;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}