/* Olverra AI - Mobile Optimized Red & White Theme */

/* ============================================================================
   BASE STYLES
   ============================================================================ */

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

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ffffff 0%, #fff5f5 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    display: flex;
    width: 95%;
    max-width: 1600px;
    height: 92vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(220, 38, 38, 0.1);
    overflow: hidden;
    border: 1px solid #fee2e2;
}

/* ============================================================================
   LEFT SIDEBAR - CHAT HISTORY (RED THEME)
   ============================================================================ */

.sidebar {
    width: 280px;
    background: #dc2626;
    display: flex;
    flex-direction: column;
    border-right: 2px solid #b91c1c;
}

.sidebar-header {
    padding: 24px 20px;
    background: #b91c1c;
    color: white;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h3 {
    font-size: 18px;
    margin-bottom: 12px;
    font-weight: 600;
}

.new-chat-btn {
    width: 100%;
    padding: 10px 16px;
    background: white;
    color: #dc2626;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.new-chat-btn:hover {
    background: #fee2e2;
    transform: translateY(-1px);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.history-item {
    padding: 12px 14px;
    margin-bottom: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.history-item:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.3);
    transform: translateX(4px);
}

.history-item.active {
    background: white;
}

.history-item .intent {
    font-size: 11px;
    color: rgba(255,255,255,0.8);
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.history-item.active .intent {
    color: #dc2626;
}

.history-item .text {
    font-size: 13px;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.history-item.active .text {
    color: #1f2937;
}

.history-item .time {
    font-size: 10px;
    color: rgba(255,255,255,0.6);
}

.history-item.active .time {
    color: #6b7280;
}

/* ============================================================================
   MAIN CONTENT AREA
   ============================================================================ */

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fafafa;
}

.chat-header {
    padding: 20px 30px;
    background: white;
    border-bottom: 2px solid #fee2e2;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-left h1 {
    font-size: 24px;
    color: #dc2626;
    margin-bottom: 4px;
    font-weight: 700;
}

.chat-header-left p {
    font-size: 14px;
    color: #6b7280;
}

.chat-header-right {
    display: flex;
    gap: 12px;
}

.header-btn {
    padding: 8px 16px;
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.header-btn:hover {
    background: #fecaca;
}

/* TWO-COLUMN LAYOUT */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* LEFT: Chat Input (Narrow) */
.chat-input-column {
    width: 400px;
    background: white;
    border-right: 2px solid #fee2e2;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

/* RIGHT: Results Display (Wide) */
.results-column {
    flex: 1;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Chat Input Styling */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-section h3 {
    font-size: 16px;
    color: #dc2626;
    font-weight: 600;
    margin-bottom: 4px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #fee2e2;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: #dc2626;
    background: #fff5f5;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.input-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Combobox */
.combobox-wrapper {
    position: relative;
}

.combobox-input {
    width: 100%;
    padding: 12px 40px 12px 12px !important;
}

.combobox-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #dc2626;
    cursor: pointer;
    font-size: 12px;
    user-select: none;
}

.combobox-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 2px solid #dc2626;
    border-radius: 8px;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
    z-index: 1000;
    display: none;
}

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

.combobox-option {
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.combobox-option:hover {
    background: #fff5f5;
    color: #dc2626;
}

/* Checkbox styling for image generation */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px;
    background: #fff5f5;
    border: 2px solid #fee2e2;
    border-radius: 8px;
    transition: all 0.2s;
}

.checkbox-label:hover {
    background: #fee2e2;
    border-color: #fecaca;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #dc2626;
}

.checkbox-label span {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.checkbox-label input[type="checkbox"]:checked + span {
    color: #dc2626;
}

/* Image Upload */
.image-upload-box {
    border: 2px dashed #fecaca;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: #fff5f5;
    cursor: pointer;
    transition: all 0.2s;
}

.image-upload-box:hover {
    border-color: #dc2626;
    background: #fee2e2;
}

.image-upload-box input[type="file"] {
    display: none;
}

.upload-icon {
    font-size: 32px;
    color: #dc2626;
    margin-bottom: 8px;
}

.upload-text {
    font-size: 13px;
    color: #6b7280;
}

.upload-status {
    font-size: 12px;
    color: #dc2626;
    margin-top: 8px;
    font-weight: 600;
}

/* Send Button */
.send-btn {
    width: 100%;
    padding: 14px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 16px;
}

.send-btn:hover:not(:disabled) {
    background: #b91c1c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* Results Display Area */
.results-display {
    padding: 30px;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
}

.welcome-message h2 {
    font-size: 32px;
    color: #dc2626;
    margin-bottom: 16px;
    font-weight: 700;
}

.welcome-message p {
    font-size: 16px;
    color: #6b7280;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto 30px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.quick-action {
    padding: 16px 20px;
    background: white;
    border: 2px solid #fee2e2;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.quick-action:hover {
    border-color: #dc2626;
    background: #fff5f5;
    color: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.1);
}

/* Response Card */
.response-card {
    background: white;
    border: 2px solid #fee2e2;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

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

.response-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #fee2e2;
}

.intent-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #dc2626;
    color: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.confidence-badge {
    padding: 6px 12px;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.response-content {
    font-size: 15px;
    line-height: 1.7;
    color: #374151;
}

.response-content h3 {
    font-size: 18px;
    color: #dc2626;
    margin: 20px 0 12px;
    font-weight: 600;
}

.response-content p {
    margin: 12px 0;
}

.response-content ul {
    margin: 12px 0;
    padding-left: 20px;
}

.response-content li {
    margin: 8px 0;
}

.response-content strong {
    color: #dc2626;
}

.response-image {
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #fee2e2;
}

.response-image img {
    width: 100%;
    display: block;
}

/* Image info styling */
.image-info {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: #fff5f5;
    border-top: 1px solid #fee2e2;
    font-size: 12px;
    color: #6b7280;
    margin-top: -2px;
}

.image-info span {
    font-weight: 500;
}

.response-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #fee2e2;
    font-size: 12px;
    color: #9ca3af;
}

/* Loading Animation */
.loading {
    display: flex;
    gap: 6px;
    padding: 20px;
    justify-content: center;
}

.loading span {
    width: 10px;
    height: 10px;
    background: #dc2626;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading span:nth-child(1) { animation-delay: -0.32s; }
.loading span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Scrollbar Styling */
.results-column::-webkit-scrollbar,
.chat-input-column::-webkit-scrollbar {
    width: 8px;
}

.results-column::-webkit-scrollbar-track,
.chat-input-column::-webkit-scrollbar-track {
    background: #f9fafb;
}

.results-column::-webkit-scrollbar-thumb,
.chat-input-column::-webkit-scrollbar-thumb {
    background: #fecaca;
    border-radius: 4px;
}

.results-column::-webkit-scrollbar-thumb:hover,
.chat-input-column::-webkit-scrollbar-thumb:hover {
    background: #dc2626;
}

/* ============================================================================
   MOBILE RESPONSIVE OPTIMIZATIONS
   ============================================================================ */

/* Tablets (768px - 1024px) */
@media (max-width: 1024px) {
    .chat-input-column {
        width: 350px;
    }
    
    .sidebar {
        width: 240px;
    }
    
    .sidebar-header {
        padding: 20px 16px;
    }
    
    .sidebar-header h3 {
        font-size: 16px;
    }
    
    .chat-header {
        padding: 16px 24px;
    }
    
    .chat-header-left h1 {
        font-size: 20px;
    }
    
    .chat-header-left p {
        font-size: 13px;
    }
    
    .welcome-message h2 {
        font-size: 28px;
    }
    
    .quick-actions {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

/* Mobile Devices (max-width: 768px) */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }
    
    /* Hide sidebar on mobile, show as drawer if needed */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        width: 280px;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    /* Adjust header for mobile */
    .chat-header {
        padding: 12px 16px;
    }
    
    .chat-header-left h1 {
        font-size: 18px;
    }
    
    .chat-header-left p {
        font-size: 12px;
    }
    
    .chat-header-right {
        gap: 8px;
    }
    
    .header-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    /* Stack columns vertically on mobile */
    .main-content {
        flex-direction: column;
    }
    
    .chat-input-column {
        width: 100%;
        border-right: none;
        border-bottom: 2px solid #fee2e2;
        max-height: 45vh;
        padding: 16px;
    }
    
    .results-column {
        max-height: 55vh;
    }
    
    /* Adjust input section for mobile */
    .input-section {
        gap: 12px;
    }
    
    .input-section h3 {
        font-size: 14px;
        margin-bottom: 0;
    }
    
    .input-group label {
        font-size: 12px;
    }
    
    .input-group input,
    .input-group select,
    .input-group textarea {
        padding: 10px;
        font-size: 13px;
    }
    
    .input-group textarea {
        min-height: 80px;
    }
    
    .combobox-option {
        padding: 10px;
        font-size: 13px;
    }
    
    .checkbox-label {
        padding: 10px;
    }
    
    .checkbox-label span {
        font-size: 13px;
    }
    
    .checkbox-label input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }
    
    .image-upload-box {
        padding: 16px;
    }
    
    .upload-icon {
        font-size: 28px;
    }
    
    .upload-text {
        font-size: 12px;
    }
    
    .send-btn {
        padding: 12px;
        font-size: 14px;
        margin-top: 12px;
    }
    
    /* Results display mobile optimization */
    .results-display {
        padding: 16px;
    }
    
    .welcome-message {
        padding: 40px 16px;
    }
    
    .welcome-message h2 {
        font-size: 24px;
    }
    
    .welcome-message p {
        font-size: 14px;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .quick-action {
        padding: 14px 16px;
        font-size: 13px;
    }
    
    /* Response card mobile */
    .response-card {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .response-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .intent-badge,
    .confidence-badge {
        font-size: 11px;
        padding: 5px 10px;
    }
    
    .response-content {
        font-size: 14px;
    }
    
    .response-content h3 {
        font-size: 16px;
        margin: 16px 0 10px;
    }
    
    .image-info {
        flex-direction: column;
        gap: 6px;
        padding: 10px;
        font-size: 11px;
    }
}

/* Small Mobile Devices (max-width: 480px) */
@media (max-width: 480px) {
    .chat-header-left h1 {
        font-size: 16px;
    }
    
    .chat-header-left p {
        font-size: 11px;
    }
    
    .header-btn {
        padding: 5px 8px;
        font-size: 11px;
    }
    
    .chat-input-column {
        padding: 12px;
        max-height: 40vh;
    }
    
    .results-column {
        max-height: 60vh;
    }
    
    .input-section h3 {
        font-size: 13px;
    }
    
    .input-group label {
        font-size: 11px;
    }
    
    .input-group input,
    .input-group select,
    .input-group textarea {
        padding: 9px;
        font-size: 12px;
    }
    
    .input-group textarea {
        min-height: 70px;
    }
    
    .checkbox-label span {
        font-size: 12px;
    }
    
    .send-btn {
        font-size: 13px;
        padding: 11px;
    }
    
    .results-display {
        padding: 12px;
    }
    
    .welcome-message {
        padding: 30px 12px;
    }
    
    .welcome-message h2 {
        font-size: 20px;
    }
    
    .welcome-message p {
        font-size: 13px;
    }
    
    .quick-action {
        padding: 12px 14px;
        font-size: 12px;
    }
    
    .response-card {
        padding: 14px;
    }
    
    .response-content {
        font-size: 13px;
    }
    
    .response-content h3 {
        font-size: 15px;
    }
}

/* Landscape Mobile (max-height: 500px and orientation: landscape) */
@media (max-height: 500px) and (orientation: landscape) {
    .chat-input-column {
        max-height: 50vh;
        overflow-y: auto;
    }
    
    .results-column {
        max-height: 50vh;
    }
    
    .welcome-message {
        padding: 20px 12px;
    }
    
    .welcome-message h2 {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .welcome-message p {
        font-size: 12px;
        margin-bottom: 20px;
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}