/* =========================================
   H&L Cleaning Co. — Assistant Page Styles
   Reuses CSS vars from styles.css
   ========================================= */

/* ---- Page Shell ---- */
.assistant-page {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--cream);
}

/* ---- Nav ---- */
.assistant-nav {
    background: rgba(250,248,244,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(122,154,126,0.12);
    flex-shrink: 0;
    z-index: 100;
}
.assistant-nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.assistant-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--sage-dark);
    transition: var(--transition);
}
.assistant-back:hover {
    color: var(--sage);
}

/* ---- Main Layout ---- */
.assistant-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 360px;
    min-height: 0;
    overflow: hidden;
}

/* ---- Chat Panel ---- */
.chat-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--cream);
    position: relative;
}

/* Chat Area */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
}

/* Message Bubbles */
.chat-msg {
    display: flex;
    gap: 10px;
    animation: fadeUp 0.3s ease-out both;
}
.chat-msg.user {
    flex-direction: row-reverse;
}
.chat-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 4px;
}
.chat-msg.assistant .chat-msg-avatar {
    background: var(--sage-ghost);
    color: var(--sage);
}
.chat-msg.user .chat-msg-avatar {
    background: var(--sage);
    color: var(--white);
}
.chat-msg-avatar svg {
    width: 18px;
    height: 18px;
}
.chat-msg-bubble {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 0.92rem;
    line-height: 1.65;
}
.chat-msg.assistant .chat-msg-bubble {
    background: var(--white);
    border: 1px solid var(--sage-pale);
    color: var(--text);
    border-top-left-radius: 4px;
}
.chat-msg.user .chat-msg-bubble {
    background: var(--sage);
    color: var(--white);
    border-top-right-radius: 4px;
}
.chat-msg-bubble p {
    margin-bottom: 8px;
}
.chat-msg-bubble p:last-child {
    margin-bottom: 0;
}
.chat-msg-bubble strong {
    font-weight: 500;
}
.chat-msg-bubble ul, .chat-msg-bubble ol {
    margin: 4px 0 8px 18px;
    padding: 0;
}
.chat-msg-bubble li {
    margin-bottom: 2px;
}

/* Typing Indicator */
.typing-indicator {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
}
.typing-bubble {
    display: inline-flex;
    gap: 5px;
    padding: 14px 18px;
    background: var(--white);
    border: 1px solid var(--sage-pale);
    border-radius: 16px;
    border-top-left-radius: 4px;
}
.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sage-light);
    animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

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

@keyframes popIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Chat Input */
.chat-input-area {
    border-top: 1px solid rgba(122,154,126,0.12);
    padding: 16px 24px;
    flex-shrink: 0;
    background: var(--white);
}
.chat-input-wrap {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    max-width: 720px;
    margin: 0 auto;
}
.chat-input-wrap textarea {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid var(--sage-pale);
    border-radius: var(--radius);
    background: var(--cream);
    font-size: 0.92rem;
    color: var(--text);
    outline: none;
    resize: none;
    line-height: 1.5;
    max-height: 120px;
    font-family: var(--font-body);
    transition: border-color var(--transition);
}
.chat-input-wrap textarea:focus {
    border-color: var(--sage);
    background: var(--white);
}
.chat-input-wrap textarea::placeholder {
    color: var(--text-muted);
}
.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--sage);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}
.chat-send-btn:hover {
    background: var(--sage-dark);
    transform: translateY(-1px);
}
.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: default;
    transform: none;
}
.chat-input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 720px;
    margin: 8px auto 0;
}
.chat-model-label {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.chat-legal-links {
    display: flex;
    gap: 12px;
    font-size: 0.72rem;
}
.chat-legal-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}
.chat-legal-links a:hover {
    color: var(--sage);
}

/* AI Disclaimer Notice */
.chat-ai-notice {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--sage-ghost);
    border: 1px solid var(--sage-pale);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    margin-bottom: 8px;
    line-height: 1.5;
}

/* ---- Summary Panel (Right Sidebar) ---- */
.summary-panel {
    border-left: 1px solid rgba(122,154,126,0.12);
    background: var(--white);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.summary-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}
.summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--sage-pale);
    flex-shrink: 0;
}
.summary-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--bark);
}
.summary-count {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--sage-ghost);
    padding: 4px 12px;
    border-radius: 100px;
}
.summary-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.summary-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    color: var(--text-muted);
    gap: 16px;
    padding: 40px 20px;
}
.summary-empty svg {
    color: var(--sage-light);
}
.summary-empty p {
    font-size: 0.88rem;
    line-height: 1.6;
    max-width: 240px;
}

/* Summary Item Card */
.summary-item {
    background: var(--sage-ghost);
    border: 1.5px solid var(--sage-pale);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: popIn 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
    transition: var(--transition);
}
.summary-item:hover {
    border-color: var(--sage-light);
    box-shadow: var(--shadow-sm);
}
.summary-item-info {
    flex: 1;
    min-width: 0;
}
.summary-item-name {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 2px;
}
.summary-item-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.summary-item-price {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--sage-dark);
    margin-top: 4px;
}
.summary-item-remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    margin-top: 2px;
}
.summary-item-remove:hover {
    background: rgba(200,80,80,0.1);
    color: #c85050;
}
.summary-item-remove svg {
    width: 14px;
    height: 14px;
}

/* Summary Footer */
.summary-footer {
    border-top: 2px solid var(--sage-pale);
    padding: 20px 24px;
    flex-shrink: 0;
    background: var(--cream);
}
.summary-frequency {
    margin-bottom: 12px;
}
.freq-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sage-dark);
    background: var(--sage-ghost);
    border: 1px solid var(--sage-pale);
    padding: 4px 14px;
    border-radius: 100px;
}
.summary-total-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 16px;
}
.summary-total-label {
    font-size: 0.85rem;
    color: var(--text-light);
}
.summary-total-amount {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 500;
    color: var(--sage-dark);
    line-height: 1;
}
.summary-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.summary-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.summary-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 10px;
    text-align: center;
}

/* ---- Buttons ---- */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: var(--font-body);
    font-weight: 400;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}
.btn-primary {
    background: var(--sage);
    color: var(--white);
}
.btn-primary:hover {
    background: var(--sage-dark);
}
.btn-outline {
    background: transparent;
    color: var(--sage-dark);
    border: 1.5px solid var(--sage-pale);
}
.btn-outline:hover {
    border-color: var(--sage);
    background: var(--sage-ghost);
}
.btn-lg {
    padding: 14px 24px;
    font-size: 0.95rem;
}
.btn-full {
    width: 100%;
}

/* ---- Mobile Summary Bar ---- */
.mobile-summary-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    background: var(--white);
    border-top: 2px solid var(--sage-pale);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -4px 20px rgba(90,80,60,0.08);
}
.msb-info {
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.msb-count {
    font-size: 0.82rem;
    color: var(--text-light);
}
.msb-total {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--sage-dark);
}
.msb-toggle {
    padding: 8px 18px;
    border-radius: 100px;
    background: var(--sage);
    color: var(--white);
    font-size: 0.82rem;
    font-weight: 400;
    font-family: var(--font-body);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}
.msb-toggle:hover {
    background: var(--sage-dark);
}
.msb-actions {
    display: flex;
    gap: 8px;
}
.msb-send {
    padding: 8px 18px;
    border-radius: 100px;
    background: var(--sage-dark);
    color: var(--white);
    font-size: 0.82rem;
    font-weight: 500;
    font-family: var(--font-body);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}
.msb-send:hover {
    background: var(--sage-deeper);
}

/* Mobile summary overlay */
.summary-panel.mobile-open {
    display: flex !important;
    position: fixed;
    inset: 64px 0 0 0;
    z-index: 95;
    animation: slideUp 0.3s ease-out both;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    position: relative;
    box-shadow: var(--shadow-lg);
}
.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}
.modal-close:hover {
    background: var(--sage-ghost);
    color: var(--text);
}
.modal-close svg {
    width: 20px;
    height: 20px;
}
.modal-header {
    margin-bottom: 20px;
}
.modal-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--bark);
    margin-bottom: 6px;
}
.modal-sub {
    font-size: 0.88rem;
    color: var(--text-light);
    line-height: 1.5;
}
.modal-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.modal-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--sage-ghost);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
}
.msi-label {
    color: var(--text);
}
.msi-price {
    font-family: var(--font-display);
    font-weight: 500;
    color: var(--sage-dark);
}
.modal-total-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 12px 0;
    margin-bottom: 20px;
    border-top: 1.5px solid var(--sage-pale);
    font-size: 0.88rem;
    color: var(--text-light);
}
.modal-total-amount {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--sage-dark);
}
.modal-total-freq {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Modal Form */
.modal-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.form-group label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-light);
    margin-bottom: 4px;
}
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--sage-pale);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--cream);
    outline: none;
    transition: var(--transition);
}
.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--sage);
    background: var(--white);
}
.form-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 4px;
}

/* Form Success */
.form-success {
    display: none;
    text-align: center;
    padding: 20px 0;
}
.form-success.active {
    display: block;
    animation: fadeUp 0.4s ease-out;
}
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}
.success-circle {
    stroke-dasharray: 226;
    stroke-dashoffset: 226;
    animation: drawCircle 0.6s ease forwards;
}
.success-check {
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    animation: drawCheck 0.4s ease forwards 0.4s;
}
@keyframes drawCircle {
    to { stroke-dashoffset: 0; }
}
@keyframes drawCheck {
    to { stroke-dashoffset: 0; }
}
.success-heading {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--bark);
    margin-bottom: 8px;
}
.success-sub {
    font-size: 0.88rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 20px;
}
.success-close-btn {
    margin: 0 auto;
}

/* Hiding animation for modal content */
.hiding {
    opacity: 0;
    transform: translateY(-8px);
    transition: all 0.3s ease;
}

/* ---- Mobile Responsive ---- */
@media (max-width: 768px) {
    .assistant-layout {
        grid-template-columns: 1fr;
    }
    .summary-panel {
        display: none;
    }
    .chat-panel {
        padding-bottom: 60px;
    }
    .chat-area {
        padding: 16px;
    }
    .chat-input-area {
        padding: 12px 16px;
    }
    .chat-msg-bubble {
        max-width: 88%;
    }
    .assistant-nav-inner {
        padding: 0 16px;
        height: 56px;
    }
    .nav-logo span {
        font-size: 1rem;
    }
}

/* ---- Print Styles ---- */
@media print {
    .assistant-nav,
    .chat-panel,
    .mobile-summary-bar,
    .modal-overlay,
    .summary-actions,
    .summary-note,
    .summary-item-remove {
        display: none !important;
    }

    .assistant-page {
        height: auto;
        overflow: visible;
    }

    .assistant-layout {
        display: block;
    }

    .summary-panel {
        display: block !important;
        border: none;
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
    }

    .summary-card {
        height: auto;
    }

    .summary-header {
        border-bottom: 2px solid #ccc;
        padding: 0 0 12px;
        margin-bottom: 16px;
    }

    .summary-title {
        font-size: 1.6rem;
    }

    .summary-title::before {
        content: "H&L Cleaning Co. — ";
    }

    .summary-items {
        padding: 0;
        overflow: visible;
    }

    .summary-item {
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .summary-footer {
        border-top: 2px solid #ccc;
        padding: 16px 0 0;
        margin-top: 16px;
    }

    .summary-total-amount {
        font-size: 2.2rem;
    }
}
