/* ==========================================================================
   Webtactic AI Quotation System — Frontend Stylesheet
   Phase 7: Chatbot Interface Design System
   ========================================================================== */

:root {
    /* Color Palette */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    
    /* Message Bubble Colors */
    --bot-bubble-bg: #ffffff;

    --bot-bubble-text: #0f172a;
    --bot-bubble-border: #e2e8f0;
    --user-bubble-bg: #2563eb;
    --user-bubble-text: #ffffff;

    /* Error & Alert Colors */
    --error-bg: #fef2f2;
    --error-border: #fca5a5;
    --error-text: #dc2626;

    /* Typography & Spacing */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Reset & Box Sizing */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    display: flex;
}

/* Screen Reader Only Utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Application Wrapper */
.app-container {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    display: flex;
    background-color: var(--card-bg);
    box-shadow: none;
    border-radius: 0;
    overflow: hidden;
}

@media (min-width: 768px) {
    .app-container {
        height: 100vh;
        border: none;
    }
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background-color: #0b0f19; /* Premium dark navy */
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    padding: 1.75rem;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.brand-logo {
    width: 38px;
    height: 38px;
    max-width: 38px;
    max-height: 38px;
    display: block;
    object-fit: contain;
    background: transparent !important;
    background-color: transparent !important;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    flex: 0 0 38px;
}

.brand-title {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #ffffff;
    margin: 0;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0;
}

/* Sidebar Action Container & New Quotation Button */
.sidebar-action-container {
    margin-bottom: 0.75rem;
}

.btn-sidebar-new {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    color: #f1f5f9;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-sidebar-new:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* Sidebar Search */
.sidebar-search-container {
    margin-bottom: 1rem;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 0.75rem;
    color: #64748b;
    pointer-events: none;
}

.history-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: #e2e8f0;
    font-size: 0.8rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.history-search-input::placeholder {
    color: #64748b;
}

.history-search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* History Container & Groups */
.history-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-right: 0.25rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.history-container::-webkit-scrollbar {
    width: 4px;
}

.history-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.history-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.history-group-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 0 0.5rem;
    margin-bottom: 0.1rem;
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-item {
    display: flex;
    flex-direction: column;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    border: 1px solid transparent;
    user-select: none;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.history-item.active {
    background: rgba(37, 99, 235, 0.18);
    border-color: rgba(37, 99, 235, 0.4);
    color: #ffffff;
}

.history-item-title {
    font-size: 0.825rem;
    font-weight: 500;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.history-item.active .history-item-title {
    color: #ffffff;
    font-weight: 600;
}

.history-item-status {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 2px;
}

.history-item.active .history-item-status {
    color: #93c5fd;
}

.history-empty {
    font-size: 0.8rem;
    color: #64748b;
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-style: italic;
}

.help-card h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0 0 0.5rem 0;
}

.help-card p {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0 0 0.85rem 0;
    line-height: 1.45;
}

.help-link {
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.help-link:hover {
    color: #60a5fa;
    text-decoration: none;
}

/* Mobile Sidebar behavior */
@media (max-width: 767px) {
    .sidebar {
        display: none;
    }
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.75rem;
    background-color: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
}

.header-bot-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bot-avatar-container {
    position: relative;
}

.bot-avatar,
.bot-avatar-inline {
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    isolation: isolate;
}

.bot-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    max-width: 40px;
    max-height: 40px;
    background-color: #eff6ff;
    color: #2563eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dbeafe;
}

.bot-avatar svg {
    width: 22px;
    height: 22px;
}

.online-status {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background-color: #10b981;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

.bot-details {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.bot-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background-color: #eff6ff;
    color: #1e40af;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid #dbeafe;
    align-self: flex-start;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.btn-icon svg {
    margin-right: 0.5rem;
}

@media (max-width: 480px) {
    .btn-icon .btn-text {
        display: none;
    }
    .btn-icon svg {
        margin-right: 0;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.2);
}

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

/* Chat Wrapper */
.chat-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow-y: auto;
    background-color: var(--bg-color);
    gap: 1rem;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Message Bubbles */
.message-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.message-row {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    max-width: 80%;
    animation: fadeIn 0.3s ease-out;
    margin-bottom: 1.25rem;
}

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

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

.bot-avatar-inline {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    max-width: 36px;
    max-height: 36px;
    background-color: #eff6ff;
    color: #2563eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dbeafe;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.bot-avatar-inline svg {
    width: 20px;
    height: 20px;
}

.bot-avatar img,
.bot-avatar-inline img {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    display: block !important;
    object-fit: contain !important;
    object-position: center !important;
    position: static !important;
    inset: auto !important;
    transform: none !important;
    margin: 0 !important;
    padding: 3px !important;
    border-radius: 50%;
}

.chat-bubble {
    padding: 0.95rem 1.25rem;
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    line-height: 1.5;
    word-break: break-word;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.bot-bubble {
    background-color: #ffffff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    border-top-left-radius: 4px;
}

.bot-bubble.error-bubble {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
    font-weight: 500;
}

.user-bubble {
    background-color: #2563eb;
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.12), 0 2px 4px -1px rgba(37, 99, 235, 0.07);
}

.message-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    padding: 0 0.5rem;
}

.message-row.user .message-time {
    text-align: right;
}

/* Loader */
.chat-loader-container {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    align-self: flex-start;
    animation: fadeIn 0.2s ease;
    margin-bottom: 1.25rem;
}

.loader-bubble {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.1rem;
    min-height: 42px;
    min-width: 64px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    border-top-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.typing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
.typing-indicator span:nth-child(3) { animation-delay: 0s; }

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

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

/* Error Banner */
.error-banner {
    background-color: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    box-shadow: var(--shadow-sm);
}

/* Status Notice Bar */
.status-notice {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

/* Footer Input Area */
.chat-footer {
    padding: 1rem 1.75rem;
    background-color: #ffffff;
    border-top: 1px solid #f1f5f9;
}

.chat-input-form {
    display: flex;
    gap: 0.75rem;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1px solid #cbd5e1;
    border-radius: 24px;
    outline: none;
    transition: all 0.2s ease;
    background-color: #f8fafc;
}

.chat-input:focus:not(:disabled) {
    border-color: var(--primary-color);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.chat-input:disabled {
    background-color: #e2e8f0;
    color: var(--text-muted);
    cursor: not-allowed;
    border-color: #e2e8f0;
}

/* Utility Hidden */
.hidden {
    display: none !important;
}

/* Service Selection Controls */
.service-controls-container {
    animation: fadeIn 0.3s ease;
}

.service-selection-card {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.25rem;
    max-width: 600px;
}

.selection-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 576px) {
    .selection-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.selection-actions {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #f1f5f9;
    padding-top: 1.25rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.control-label, .control-prompt {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.control-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.select-dropdown {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-primary);
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.15em;
    padding-right: 2.5rem;
}

.select-dropdown:focus:not(:disabled) {
    border-color: var(--primary-color);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.select-dropdown:disabled {
    background-color: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
}

.add-another-card {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
    display: inline-flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 360px;
    width: fit-content;
}

.button-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.btn-compact {
    padding: 0.45rem 1.25rem !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    width: auto !important;
    min-width: 65px;
    height: auto !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    line-height: 1.2;
}

.btn-light-grey {
    background-color: #e2e8f0;
    color: #334155;
}

.btn-light-grey:hover:not(:disabled) {
    background-color: #cbd5e1;
    color: #1e293b;
}

/* Requirement Summary Container (Phase 9) */
.summary-container {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    margin-top: 1rem;
    animation: fadeIn 0.3s ease;
}

.summary-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.summary-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 0.25rem 0;
}

.summary-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.summary-content-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.summary-section-card {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
}

.summary-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
    margin: 0 0 0.5rem 0;
}

.summary-list {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.summary-list li {
    margin-bottom: 0.25rem;
}

.summary-actions-group {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 1rem;
}

.summary-confirm-prompt {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
}

.text-area-input {
    width: 100%;
    padding: 0.75rem;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-primary);
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    resize: vertical;
}

.text-area-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.margin-top-md {
    margin-top: 1rem;
}

/* Project Estimate Container (Phase 10) */
.estimate-container {
    background-color: var(--card-bg);
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    margin-top: 1rem;
    animation: fadeIn 0.3s ease;
}

.estimate-header {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
}

.estimate-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 0.25rem 0;
}

.estimate-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.estimate-content-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.estimate-total-card {
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.total-amount {
    font-size: 1.35rem;
    font-weight: 800;
    color: #1e293b;
}

.estimate-line-item {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
}

.line-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}

.line-item-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.line-item-amount {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-color);
}

.line-item-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.estimate-meta-card {
    background-color: #f1f5f9;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.estimate-footer-notice {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 1.25rem;
    text-align: center;
}

.notice-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    margin: 0;
}

/* Phase 11 Approval Controls */
.approval-controls-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.btn-secondary {
    background-color: #64748b;
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-secondary:hover {
    background-color: #475569;
}

#new-quotation-btn:hover:not(:disabled),
#download-pdf-btn:hover:not(:disabled) {
    background-color: #475569;
    color: #ffffff;
}

#new-quotation-btn:focus,
#download-pdf-btn:focus {
    background-color: #64748b;
    color: #ffffff;
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

#new-quotation-btn:focus:hover:not(:disabled),
#download-pdf-btn:focus:hover:not(:disabled) {
    background-color: #475569;
    color: #ffffff;
}

.btn-danger {
    background-color: #ef4444;
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-danger:hover {
    background-color: #dc2626;
}


/* ── Phase 12 Quotation Container ───────────────────────────────────────────── */

.quotation-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.quotation-header {
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.75rem;
}

.quotation-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.quotation-tag {
    background: var(--primary-color);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.quotation-ref-badge {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: monospace;
    background: var(--surface-secondary);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.quotation-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.quotation-content-body {
    background: var(--surface-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    max-height: 500px;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'Courier New', Courier, monospace;
}

.quotation-actions-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Phase 13 Review, Revisions and Finalization */
.quotation-version-select {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background-color: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
}

.quotation-version-select:focus {
    border-color: var(--primary-color);
}

.quotation-review-group {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 1rem;
}

.review-prompt {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
}

.quotation-finalized-banner {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    animation: fadeIn 0.3s ease;
}

/* Closed chat read-only overlay style */
.chat-closed-overlay {
    position: relative;
}

.chat-closed-overlay::after {
    content: "This chat is closed (revision period expired)";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(241, 245, 249, 0.6);
    backdrop-filter: blur(1px);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #475569;
    z-index: 1000;
    pointer-events: all;
    cursor: not-allowed;
}

.chat-input-area.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* Phase 12: Code style box for final quotation */
.quotation-code-box {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow-x: auto;
    width: 100%;
    box-sizing: border-box;
    background-color: #0b0f19;
    color: #f1f5f9;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    border: 1px solid #1e293b;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-top: 0.5rem;
}
.quotation-code-box code {
    font-family: inherit;
    color: inherit;
}

/* Selected Service Card */
.selected-service-message {
    display: block;
    margin-bottom: 0.25rem;
}

.selected-service-card {
    display: inline-block;
    min-width: 260px;
    max-width: 360px;
    padding: 22px 26px;
    background: #ffffff;
    border: 1px solid #dfe5ef;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    text-align: center;
    box-sizing: border-box;
}

.selected-service-label {
    margin-top: 10px;
    font-weight: 700;
    color: #4763e8;
}

.selected-service-label:first-child {
    margin-top: 0;
}

.selected-service-value {
    margin-top: 4px;
    color: #1f2937;
    font-weight: 500;
}
