/* =========================================================
   RESET בסיסי
   אחראי: איפוס מרווחים/פדינג ויישור box-sizing כדי למנוע הפתעות בעיצוב
========================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =========================================================
   BODY / רקע כללי
   אחראי: פונט, צבעים, גובה מסך מלא, ומונע גלילה של כל הדף
========================================================= */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: #f9fafb;
    color: #0f172a;
    height: 100vh;
    overflow: hidden;
}

/* =========================================================
   מעטפת עמוד צ'אט
   אחראי: להחזיק את כל המסך ולהכיל את הקונטיינר הראשי
========================================================= */
.chat-page {
    height: 100vh;
    display: flex;
    justify-content: stretch;
    align-items: stretch;
    padding: 0;
}

/* =========================================================
   GRID ראשי: סיידבר + אזור צ'אט
   אחראי: פריסה של 2 עמודות (סיידבר 300px + הצ'אט)
========================================================= */
.chat-container {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    width: 100%;
    height: 100vh;
    background: #ffffff;
    overflow: hidden;
}

/* =========================================================
   SIDEBAR (צד ימין)
   אחראי: צבע רקע כהה, פריסה אנכית, ריווחים
========================================================= */
.sidebar {
    background: linear-gradient(180deg, #0f172a 0%, #020617 100%);
    color: #e5e7eb;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100vh;
}

/* =========================================================
   SIDEBAR HEADER (לוגו + כותרת)
   אחראי: יישור למרכז ותצוגת הלוגו/כותרות
========================================================= */
.sidebar-header {
    text-align: center;
}

.logo-image {
    width: 78px;
    height: 78px;
    border-radius: 24px;
    margin-bottom: 14px;
    border: 2px solid rgba(148, 163, 184, 0.8);
    object-fit: cover;
}

.logo-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #e5e7eb;
    margin-bottom: 4px;
}

.logo-subtitle {
    font-size: 12px;
    color: #9ca3af;
}

/* =========================================================
   QUICK ACTIONS MENU (רשימת פעולות)
   אחראי: סטייל של רשימת הפעולות בסיידבר
========================================================= */
.sidebar-menu {
    margin-top: 32px;
}

.sidebar-section-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #6b7280;
    margin-bottom: 10px;
}

.sidebar-menu ul {
    list-style: none;
}

.sidebar-menu li {
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s ease, transform 0.1s ease;
    background: rgba(15, 23, 42, 0.65);
}

.sidebar-menu li:hover {
    background: rgba(59, 130, 246, 0.18);
    transform: translateY(-1px);
}

/* =========================================================
   SIDEBAR FOOTER (גרסת בטא)
   אחראי: הצגת pill של "גרסת בטא"
========================================================= */
.sidebar-footer {
    margin-top: 32px;
    display: flex;
    justify-content: center;
}

.beta-pill {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    font-size: 11px;
    color: #e5e7eb;
}

/* =========================================================
   MAIN CHAT (החלק המרכזי)
   אחראי: פריסה אנכית של header / messages / input
========================================================= */
.main-chat {
    display: flex;
    flex-direction: column;
    background: #f9fafb;
    height: 100vh;
}

/* =========================================================
   CHAT HEADER (כותרת עליונה)
   אחראי: כותרת, תיאור, סטטוס Online
========================================================= */
.chat-header {
    padding: 18px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(248, 250, 252, 0.96);
    backdrop-filter: blur(12px);
}

.chat-header-main h2 {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
}

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

.chat-header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #16a34a;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.25);
}

/* =========================================================
   CHAT MESSAGES (אזור ההודעות)
   אחראי: גלילה פנימית של ההודעות וריווחים
========================================================= */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 24px 16px;
    scroll-behavior: smooth;
}

/* =========================================================
   הודעות (Bubble UI)
   אחראי: אווטארים + בועות הודעה + צבע חלופי
========================================================= */
.message-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
}

.robot-avatar,
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    object-fit: cover;
}

.message {
    background: #ffffff;
    border-radius: 16px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #0f172a;
    max-width: 70%;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.message-wrapper:nth-child(2n) .message {
    background: #eff6ff;
}

/* =========================================================
   INPUT AREA (שדה הקלט + כפתור שליחה)
   אחראי: תיבה מעוגלת, טקסט RTL, אוטו-גובה ל-textarea
========================================================= */
.chat-input-container {
    padding: 12px 24px 18px;
    border-top: 1px solid #e5e7eb;
    background: linear-gradient(to top, #f9fafb 60%, rgba(249, 250, 251, 0.3));
}

.input-wrapper {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
    align-items: center;
    background: #ffffff;
    border-radius: 999px;
    padding: 8px 10px;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.12);
}

#messageInput {
    flex: 1;
    border: none;
    background: transparent;
    font-family: "Heebo", "Assistant", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: #0f172a;
    padding: 10px 12px;
    resize: none;
    overflow-y: hidden;
    min-height: 22px;
    max-height: 160px;
    text-align: right;
    direction: rtl;
}

#messageInput::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

#messageInput:focus {
    outline: none;
}

button#sendButton {
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.5);
    transition: transform 0.09s ease, box-shadow 0.12s ease, opacity 0.12s ease;
    white-space: nowrap;
}

button#sendButton:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 14px 38px rgba(37, 99, 235, 0.6);
}

button#sendButton:disabled {
    opacity: 0.6;
    box-shadow: none;
    cursor: default;
}

.input-caption {
    max-width: 720px;
    margin: 6px auto 0;
    font-size: 11px;
    color: #6b7280;
    text-align: right;
}

/* =========================================================
   MOBILE (עד 900px)
   אחראי: בנייד מסתירים סיידבר ומרחיבים את הצ'אט
========================================================= */
@media (max-width: 900px) {
    .chat-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .chat-header {
        padding: 14px 16px;
    }

    .chat-messages {
        padding: 14px 16px;
    }

    .chat-input-container {
        padding: 10px 16px 16px;
    }

    .input-wrapper {
        max-width: 100%;
    }
}

/* =========================================================
   TYPING INDICATOR (שלוש נקודות)
   אחראי: בועה קטנה של "ראסי כותב"
========================================================= */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: #ffffff;
    padding: 10px 14px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    margin-bottom: 12px;
    width: 60px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    opacity: 0.4;
    animation: typingBlink 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBlink {
    0% { opacity: 0.2; transform: translateY(0px); }
    50% { opacity: 1; transform: translateY(-3px); }
    100% { opacity: 0.2; transform: translateY(0px); }
}

/* =========================================================
   QUICK BOXES (Accordion) – פעולות מהירות בסיידבר
   אחראי: "חלון יורד" לטפסים כמו הוספת ליד / חיפוש טלפון
========================================================= */
.quick-box {
    margin-top: 0;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.15);
    background: linear-gradient(
        180deg,
        rgba(30, 41, 59, 0.85),
        rgba(15, 23, 42, 0.85)
    );
}
.quick-box + .quick-box {
    border-top: none;
}



/* כפתור פתיחה/סגירה */
.quick-box-toggle {
    width: 100%;
    padding: 12px 12px;
    border: none;
    background: transparent;
    color: #e5e7eb;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quick-box-toggle:hover {
    background: rgba(59, 130, 246, 0.12);
}

/* חץ */
.quick-box-toggle .chev {
    opacity: 0.85;
    transition: transform 0.18s ease;
}

.quick-box-toggle.open .chev {
    transform: rotate(180deg);
}

/* התוכן הנפתח */
.quick-box-content {
    display: none;
    padding: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.quick-box-content.open {
    display: block;
}

/* שדות בתוך ה״חלון״ */
.quick-box-content input {
    width: 100%;
    margin-bottom: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(2, 6, 23, 0.6);
    color: #e5e7eb;
    font-size: 13px;
}

.quick-box-content input::placeholder {
    color: #9ca3af;
}

.quick-box-content input:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

/* כפתור פעולה בתוך ה״חלון״ */
.quick-box-btn {
    width: 100%;
    margin-top: 4px;
    padding: 9px;
    border-radius: 999px;
    border: none;
    font-size: 13px;
    font-weight: 700;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.45);
    transition: transform 0.1s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.quick-box-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 36px rgba(37, 99, 235, 0.6);
    opacity: 0.95;
}

.quick-box { 
    margin: 0 !important; 
  }
  .quick-box + .quick-box { 
    margin-top: 0 !important; 
  }
  
