/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600&family=Manrope:wght@300;400;500;600&display=swap');

/* Global Styles */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Manrope', sans-serif;
    color: #030D11;
}

/* Main Background */
.main-background {
    background-color: #308AD8;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Logo Container */
.logo-container {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.logo-box {
    display: flex;
    align-items: center;
    justify-content: center;
}

.company-logo {
    max-height: 50px;
    max-width: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Main Container */
.main-container {
    width: 100%;
    max-width: 1200px;
    margin: 60px auto 20px;
    padding-bottom: 20px;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 140px);
}

/* Content Box */
.content-box {
    background-color: var(--white-color);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    width: 100%;
    min-height: 600px;
    display: flex;
    flex-direction: column;
}

.content-box .container-fluid {
    height: 100%;
    padding: 0;
}

.content-box .row {
    height: 100%;
    margin: 0;
}

/* Header adjustments for rounded container */
.header-section {
    border-radius: 20px 20px 0 0;
    margin: 0;
    background: linear-gradient(90deg, #1ac74c 0%, #308ad8 100%) !important;
}

.header-section h3 {
    color: var(--white-color) !important;
}

.header-section i {
    color: var(--white-color) !important;
}

/* Typography */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    color: #030D11;
}

/* Custom Color Variables */
:root {
    --primary-color: #308AD8;
    --secondary-color: #030D11;
    --white-color: #F9F9F9;
    --text-color: #030D11;
    --border-color: #e0e0e0;
}

.h-100 {
    height: 100% !important;
}

/* Chat Container */
#chatContainer {
    background: white;
    display: flex;
    flex-direction: column;
}

/* Mobile chat container adjustments */
@media (max-width: 768px) {
    #chatContainer.flex-grow-1.p-3.overflow-auto,
    .chat-section #chatContainer {
        padding: 0.5rem !important;
        margin: 0 !important;
    }
}

/* Booking Form Styles */
.booking-form-container {
    background: var(--white-color);
    border-right: 1px solid var(--border-color);
}

.bg-light {
    background-color: var(--white-color) !important;
}

#bookingForm .form-control {
    border-radius: 6px;
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    font-family: 'Manrope', sans-serif;
    color: var(--text-color);
    background-color: white;
}

#bookingForm .form-control::placeholder {
    color: #999;
}

#bookingForm .form-select {
    font-family: 'Manrope', sans-serif;
    color: var(--text-color);
}

#bookingForm .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(48, 138, 216, 0.25);
}

#startAssistantBtn {
    padding: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
}

#startAssistantBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 123, 255, 0.3);
}

.form-label {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-family: 'Montserrat', sans-serif;
}

#chatMessages {
    padding: 1rem;
    overflow-y: auto;
    flex-grow: 1;
}

/* Message Styles */
.message {
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease-out;
}

.message-content {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    max-width: 80%;
    word-wrap: break-word;
}

.user-message .message-content {
    background-color: var(--primary-color);
    color: var(--white-color);
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.assistant-message .message-content {
    background-color: white;
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
    color: var(--text-color);
}

/* Input Area */
.input-group {
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

#messageInput {
    border: 2px solid #e9ecef;
    border-radius: 8px 0 0 8px;
    padding: 0.75rem;
    font-size: 1rem;
}

#messageInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(48, 138, 216, 0.25);
}

#sendBtn {
    border-radius: 0 8px 8px 0;
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Header Styles */
.bg-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #2470c7 100%) !important;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #2470c7;
    border-color: #2470c7;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white-color);
}

.btn-danger {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-outline-danger {
    color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-outline-danger:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--white-color);
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: var(--secondary-color);
}

.alert-info {
    background-color: #cce7ff;
    border-color: #b3d9ff;
    color: var(--primary-color);
}

.text-primary {
    color: var(--primary-color) !important;
}

.text-danger {
    color: var(--secondary-color) !important;
}

.is-invalid {
    border-color: var(--secondary-color) !important;
}

.invalid-feedback {
    color: var(--secondary-color);
}

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

/* Desktop Flexbox Layout */
.main-content {
    display: flex !important;
    flex-direction: row !important;
    height: 100% !important;
}

.form-section {
    flex: 0 0 35% !important;
    max-width: 35% !important;
    padding: 1rem !important;
    background-color: var(--white-color) !important;
    border-right: 1px solid var(--border-color) !important;
    overflow-y: auto !important;
}

.chat-section {
    flex: 0 0 65% !important;
    max-width: 65% !important;
    display: flex !important;
    flex-direction: column !important;
    background-color: white !important;
}

#chatContainer {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 400px !important;
    padding: 1rem !important;
    overflow: hidden !important;
}

#chatMessages {
    flex: 1 !important;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    min-height: 300px;
    -webkit-overflow-scrolling: touch;
}

/* Mobile Responsive Design - Stack vertically */
@media (max-width: 768px) {
    /* Adjust main background for mobile */
    .main-background {
        padding: 10px;
        justify-content: flex-start;
        min-height: 100vh;
    }
    
    /* Logo adjustments for mobile */
    .logo-container {
        position: relative;
        top: 0;
        left: 0;
        transform: none;
        margin-bottom: 15px;
        text-align: center;
    }
    
    .logo-box {
        display: inline-flex;
    }
    
    .company-logo {
        max-height: 35px;
        max-width: 140px;
    }
    
    /* Main container adjustments */
    .main-container {
        margin: 10px auto;
        max-width: 95%;
        min-height: auto;
    }
    
    .content-box {
        min-height: auto;
        border-radius: 15px;
        box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
        display: flex;
        flex-direction: column;
    }
    
    /* Header adjustments */
    .header-section {
        border-radius: 15px 15px 0 0;
        padding: 0.75rem !important;
        flex-shrink: 0;
    }
    
    .header-section h3 {
        font-size: 1.1rem;
    }
    
    /* Mobile layout - stack columns */
    .main-content {
        flex-direction: column !important;
        height: auto !important;
    }
    
    /* Form section - compact */
    .form-section {
        flex: 0 0 auto !important;
        max-width: 100% !important;
        width: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color) !important;
        padding: 0.75rem !important;
    }
    
    /* Chat section - take remaining space */
    .chat-section {
        flex: 1 !important;
        max-width: 100% !important;
        min-height: 300px !important;
        border-bottom: 2px solid var(--border-color) !important;
        order: 1;
    }
    
    /* Chat section - flexible height */
    .chat-section {
        flex: 1 !important;
        max-width: 100% !important;
        width: 100% !important;
        min-height: 50vh !important;
        order: 2;
    }
    
    #chatContainer {
        flex: 1 !important;
        min-height: 300px !important;
    }
    
    #chatMessages {
        flex: 1 !important;
        padding: 0.5rem;
        min-height: 250px;
        max-height: none !important;
    }
    
    /* Compact form styling */
    .booking-section .p-4 {
        padding: 0.75rem !important;
    }
    
    .booking-section .mb-3 {
        margin-bottom: 0.75rem !important;
    }
    
    .booking-section .form-label {
        margin-bottom: 0.25rem !important;
        font-size: 0.9rem;
        font-weight: 500;
        line-height: 1.3;
    }
    
    .booking-section .form-control,
    .booking-section .form-select {
        padding: 0.5rem !important;
        font-size: 0.9rem;
        line-height: 1.3;
    }
    
    .booking-section .alert {
        padding: 0.5rem !important;
        margin-bottom: 0.75rem !important;
        font-size: 0.8rem;
        line-height: 1.3;
    }
    
    .booking-section .btn {
        padding: 0.75rem !important;
        font-size: 0.9rem;
        line-height: 1.3;
    }
    
    /* Chat messages on mobile */
    .message-content {
        max-width: 95%;
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .message {
        margin-bottom: 0.5rem;
    }
    
    /* Input area on mobile */
    .border-top.p-3 {
        padding: 0.5rem !important;
        flex-shrink: 0;
    }
    
    #messageInput {
        font-size: 0.85rem;
        padding: 0.4rem;
    }
    
    #sendBtn {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 992px) {
    .col-md-4 {
        flex: 0 0 35% !important;
        max-width: 35% !important;
    }
    
    .col-md-8 {
        flex: 0 0 65% !important;
        max-width: 65% !important;
    }
}

/* Authentication Status */
#authStatus {
    display: inline-flex;
    align-items: center;
}

#authBtn {
    transition: all 0.3s ease;
}

#authBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Scrollbar Styling */
#chatMessages::-webkit-scrollbar {
    width: 6px;
}

#chatMessages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#chatMessages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#chatMessages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Icon Spacing */
.fas, .far {
    margin-right: 0.25rem;
}

/* Form Validation */
.is-invalid {
    border-color: #dd2445 !important;
}

.invalid-feedback {
    display: block;
}

/* Success/Error Messages */
.alert {
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* Button Hover Effects */
.btn {
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

/* Code Blocks in Messages */
.message-content code {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.user-message .message-content code {
    background-color: rgba(255, 255, 255, 0.2);
}
