/* =========================================================
   Future University Chatbot UI
   ========================================================= */

:root {
    --fu-blue: #0056A8;
    --fu-blue-dark: #003d73;
    --fu-blue-soft: #0C79BF;
    --fu-gold: #FFEA00;
    --fu-gold-soft: #F1C40F;
    --fu-white: #ffffff;
    --fu-bg: #f3f7fb;
    --fu-text: #17304d;
    --fu-muted: #6c7a89;
    --fu-border: rgba(0, 86, 168, 0.14);
    --fu-shadow: 0 18px 45px rgba(0, 0, 0, 0.14);
}

/* =========================
   Container
   ========================= */
#chatbot-container {
      z-index: 11002;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    direction: rtl;
    overflow: hidden;
    background:
        radial-gradient(circle at top left, rgba(255, 234, 0, 0.10), transparent 30%),
        linear-gradient(180deg, #ffffff 0%, #eef6ff 100%);
    border: 1px solid var(--fu-border);
    border-radius: 18px;
    box-shadow: var(--fu-shadow);
    font-family: 'Cairo', 'Tajawal', 'Segoe UI', Arial, sans-serif;
    color: var(--fu-text);
}


/* =========================
   Info Bar
   ========================= */
.tab-info {
    padding: 8px 14px;
    text-align: center;
    background: #fff8c7;
    border-bottom: 1px solid rgba(241, 196, 15, 0.45);
    color: #5f4b00;
    font-size: 0.78rem;
    line-height: 1.6;
}

.tab-info p {
    margin: 0;
}

/* =========================
   Chat Log
   ========================= */
#chatbot-log {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.94), rgba(238,246,255,0.94));
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Scrollbar */
#chatbot-log {
    scrollbar-width: thin;
    scrollbar-color: var(--fu-gold) rgba(0, 86, 168, 0.10);
}

#chatbot-log::-webkit-scrollbar {
    width: 8px;
}

#chatbot-log::-webkit-scrollbar-track {
    background: rgba(0, 86, 168, 0.08);
    border-radius: 20px;
}

#chatbot-log::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--fu-gold), var(--fu-gold-soft));
    border-radius: 20px;
}

/* =========================
   Messages
   ========================= */
.user-message,
.bot-message {
    position: relative;
    max-width: 88%;
    padding: 12px 15px;
    border-radius: 18px;
    line-height: 1.8;
    font-size: 0.96rem;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    text-align: right;
    animation: chatbotMessageIn 0.25s ease both;
}

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

.user-message {
    align-self: flex-start;
    color: #082b52;
    background: linear-gradient(135deg, #ffea00, #f1c40f);
    border-bottom-left-radius: 4px;
    box-shadow: 0 8px 18px rgba(241, 196, 15, 0.22);
}

.user-message::before {
    content: "\f007";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-left: 8px;
    color: #082b52;
}

.bot-message {
    align-self: flex-end;
    width: auto;
    min-width: 50%;
    color: var(--fu-text);
    background: #ffffff;
    border: 1px solid rgba(0, 86, 168, 0.10);
    border-bottom-right-radius: 4px;
    box-shadow: 0 8px 22px rgba(0, 86, 168, 0.10);
}

.bot-message::before {
    content: "\f544";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-left: 8px;
    color: var(--fu-blue);
}

/* =========================
   Error
   ========================= */
.chatbot-error {
    display: block;
    padding: 10px 12px;
    margin: 10px 0;
    color: #721c24;
    background: #fff1f2;
    border: 1px solid #f5c6cb;
    border-right: 5px solid #dc3545;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.chatbot-error .chatbot-refresh-link {
    display: inline-block;
    margin-top: 8px;
    color: var(--fu-blue);
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

/* =========================
   Suggestions
   ========================= */
.chatbotsuggestion {
    list-style: none;
    padding: 0;
    margin: 14px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chatbot-suggestion {
    position: relative;
    cursor: pointer;
    max-width: 100%;
    padding: 11px 18px;
    border-radius: 999px;
    color: var(--fu-blue-dark);
    background: #eef7ff;
    border: 1px solid rgba(0, 86, 168, 0.18);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.5;
    white-space: normal;
    box-shadow: 0 4px 12px rgba(0, 86, 168, 0.08);
    transition: all 0.25s ease;
}

.chatbot-suggestion:hover {
    background: var(--fu-blue);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0, 86, 168, 0.18);
}

.chatbot-suggestion:active {
    transform: translateY(0);
}

.disabled-suggestion {
    pointer-events: none;
    opacity: 0.55;
    cursor: not-allowed;
    background: #f1f1f1;
    color: #999;
    border-color: #ddd;
    box-shadow: none;
}

/* Match colors */
.chatbot-suggestion.high-match {
    background: #eaf8ef;
    border-color: #28a745;
    color: #155724;
}

.chatbot-suggestion.medium-match {
    background: #fff7d6;
    border-color: #f1c40f;
    color: #6b5200;
}

.chatbot-suggestion.low-match {
    background: #fff1f2;
    border-color: #dc3545;
    color: #721c24;
}

.match-percent-badge {
    position: absolute;
    top: -7px;
    left: 8px;
    background: var(--fu-blue);
    color: #fff;
    font-size: 0.65rem;
    padding: 3px 7px;
    border-radius: 999px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.16);
}

/* =========================
   Search Results
   ========================= */
#chatbot-log .bot-message .chatbot-results-title {
    margin: 16px 0 10px;
    padding-bottom: 8px;
    color: var(--fu-blue-dark);
    font-size: 1.05rem;
    font-weight: 900;
    border-bottom: 2px solid rgba(0, 86, 168, 0.12);
}

#chatbot-log .bot-message .chatbot-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#chatbot-log .bot-message .chatbot-results-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px dashed rgba(0, 86, 168, 0.16);
    font-size: 0.94rem;
}

#chatbot-log .bot-message .chatbot-results-list li:last-child {
    border-bottom: none;
}

#chatbot-log .bot-message .chatbot-results-list li .content-type {
    flex-shrink: 0;
    min-width: 28px;
    color: var(--fu-gold-soft);
    text-align: center;
}

#chatbot-log .bot-message .chatbot-results-list li .content-type i {
    font-size: 1.15rem;
}

#chatbot-log .bot-message .chatbot-results-list li a {
    color: var(--fu-blue);
    font-weight: 700;
    text-decoration: none;
}

#chatbot-log .bot-message .chatbot-results-list li a:hover {
    color: var(--fu-blue-dark);
    text-decoration: underline;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--fu-blue);
    color: #fff;
    font-size: 0.72rem;
    white-space: nowrap;
}

.chatbot-no-results-message {
    padding: 12px;
    margin: 10px 0;
    text-align: center;
    color: #5f4b00;
    background: #fff8c7;
    border-right: 5px solid var(--fu-gold);
    border-radius: 12px;
    font-weight: 700;
}

/* =========================
   AI Response
   ========================= */
.ai-response-content {
    margin-top: 12px;
    padding: 14px 16px;
    color: #26384d;
    background: #f7fbff;
    border-right: 5px solid var(--fu-blue);
    border-radius: 12px;
    line-height: 1.85;
    text-align: right;
    direction: rtl;
}

.ai-response-content h1,
.ai-response-content h2,
.ai-response-content h3 {
    color: var(--fu-blue-dark);
    font-weight: 900;
    line-height: 1.5;
}

.ai-response-content h1 {
    font-size: 1.3rem;
}

.ai-response-content h2 {
    font-size: 1.15rem;
}

.ai-response-content h3 {
    font-size: 1rem;
}

.ai-response-content ul,
.ai-response-content ol {
    padding-right: 20px;
}

.ai-attribution {
    margin-top: 8px;
    color: #9aa6b2;
    font-size: 0.76rem;
}

.ai-attribution .ai-attribution-icon {
    color: #b7c0c9;
}

/* =========================
   Status Bar
   ========================= */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px;
    color: var(--fu-muted);
    background: #ffffff;
    border-top: 1px solid rgba(0, 86, 168, 0.10);
    font-size: 0.78rem;
}

.token-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.token-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #28a745;
    box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.12);
}

.token-indicator.invalid {
    background: #dc3545;
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.12);
}

#processing-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--fu-blue);
    font-weight: 700;
}

/* =========================
   Input Area
   ========================= */
.input-send-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    background: #f7fbff;
    border-top: 1px solid rgba(0, 86, 168, 0.10);
}

#chatbot-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 48px;
    padding: 0 16px;
    border: 1px solid rgba(0, 86, 168, 0.22);
    border-radius: 999px;
    background: #fff;
    color: var(--fu-text);
    font-size: 0.98rem;
    outline: none;
    text-align: right;
    transition: all 0.25s ease;
}

#chatbot-input::placeholder {
    color: #9aa6b2;
}

#chatbot-input:focus {
    border-color: var(--fu-blue);
    box-shadow: 0 0 0 4px rgba(0, 86, 168, 0.12);
}

#chatbot-input:disabled {
    background: #eef1f4;
    cursor: not-allowed;
    opacity: 0.75;
}

#chatbot-send {
    flex-shrink: 0;
    height: 48px;
    padding: 0 20px;
    border: 0;
    border-radius: 999px;
    color: #082b52;
    background: linear-gradient(135deg, var(--fu-gold), var(--fu-gold-soft));
    font-size: 0.95rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(241, 196, 15, 0.25);
    transition: all 0.25s ease;
}

#chatbot-send:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(241, 196, 15, 0.34);
}

#chatbot-send:active {
    transform: translateY(0);
}

#chatbot-send:disabled {
    background: #b7c0c9;
    color: #fff;
    cursor: not-allowed;
    box-shadow: none;
}

/* =========================
   Loading Spinner
   ========================= */
.loading-spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-left: 6px;
    border: 3px solid rgba(0, 86, 168, 0.18);
    border-top-color: var(--fu-blue);
    border-radius: 50%;
    animation: spin 1s ease-in-out infinite;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =========================
   Mobile
   ========================= */
@media (max-width: 991.98px) {
    #chatbot-container {
        height: 100vh;
        min-height: 100vh;
        height: 100dvh;
        min-height: 100dvh;
        margin: 0;
        border-radius: 0;
        border: 0;
        box-shadow: none;
    }
    .chatbot-header {
        padding: 14px 12px;
    }

    .chatbot-header::before {
        width: 36px;
        height: 36px;
        margin-bottom: 6px;
    }

    .chatbot-header h4 {
        font-size: 1.08rem;
    }

    .tab-info {
        font-size: 0.72rem;
        padding: 7px 10px;
    }

    #chatbot-log {
        padding: 12px;
        gap: 10px;
    }

    .user-message,
    .bot-message {
        max-width: 94%;
        font-size: 0.9rem;
        padding: 10px 12px;
    }

    .bot-message {
        min-width: 0;
    }

    .chatbot-suggestion {
        flex: 1 1 100%;
        padding: 10px 14px;
        font-size: 0.86rem;
    }

    .status-bar {
        padding: 7px 10px;
        font-size: 0.72rem;
    }

    .input-send-wrapper {
        padding: 10px;
        gap: 8px;
    }

    #chatbot-input {
        height: 44px;
        font-size: 0.9rem;
        padding: 0 12px;
    }

    #chatbot-send {
        height: 44px;
        padding: 0 15px;
        font-size: 0.88rem;
    }
}

@media (max-width: 420px) {
    .input-send-wrapper {
        flex-wrap: nowrap;
    }

    #chatbot-send {
        padding: 0 13px;
    }

    .user-message,
    .bot-message {
        max-width: 98%;
    }

    .ai-response-content {
        padding: 12px;
        font-size: 0.9rem;
    }
}



























/* =========================================================
   Chatbot Final Polish
   ========================================================= */

/* ضمان ظهور أيقونات Font Awesome */
.chatbot-header::before,
.user-message::before,
.bot-message::before {
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free" !important;
    font-weight: 900 !important;
}



/* اتجاه الرسائل */
.user-message {
    align-self: flex-start;
    border-radius: 18px 18px 4px 18px;
}

.bot-message {
    align-self: flex-end;
    border-radius: 18px 18px 18px 4px;
}

/* السهم المدبب للمستخدم */
.user-message::after {
    content: "";
    position: absolute;
    right: -7px;
    bottom: 8px;
    border-width: 8px 8px 0 0;
    border-style: solid;
    border-color: #f1c40f transparent transparent transparent;
}

/* السهم المدبب للبوت */
.bot-message::after {
    content: "";
    position: absolute;
    left: -7px;
    bottom: 8px;
    border-width: 8px 0 0 8px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
}

/* أيقونة المستخدم */
.user-message::before {
    content: "\f007";
    display: inline-flex;
    margin-left: 8px;
    color: #082b52;
}

/* أيقونة البوت */
.bot-message::before {
    content: "\f544";
    display: inline-flex;
    margin-left: 8px;
    color: var(--fu-blue);
}

/* جعل نافذة الدردشة أقل تشويشًا عند الفتح مصغرة */
#chatbot-container {
    background:
        radial-gradient(circle at top left, rgba(255, 234, 0, 0.08), transparent 28%),
        linear-gradient(180deg, #ffffff 0%, #eef6ff 100%);
}

/* خلفية منطقة الرسائل أوضح */
#chatbot-log {
    background:
        linear-gradient(rgba(255,255,255,0.92), rgba(238,246,255,0.94)),
        radial-gradient(circle at top right, rgba(0,86,168,0.06), transparent 35%);
}

/* زر التكبير/التصغير داخل iframe إن وجد */
.fullscreen-toggle,
#fullscreen-toggle,
.chatbot-fullscreen-toggle {
    width: 42px !important;
    height: 42px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    font-size: 1rem !important;
    line-height: 1 !important;
    padding: 0 !important;
}

/* أزرار أعلى الشات */
.chatbot-header .fullscreen-toggle,
.chatbot-header #fullscreen-toggle,
.chatbot-header .chatbot-fullscreen-toggle {
    position: absolute;
    top: 14px;
    left: 14px;
}

/* الجوال والتابلت */
@media (max-width: 991.98px) {
    .chatbot-header {
        min-height: 104px;
    }

    .chatbot-header::before {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    .user-message,
    .bot-message {
        max-width: 92%;
    }
}







/* =========================================================
   Chatbot Header - Final Slim Fix
   ========================================================= */

.chatbot-header {
    position: relative;
    min-height: auto !important;
    padding: 10px 14px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    background: linear-gradient(135deg, #0056A8, #003d73);
    border-bottom: 3px solid #ffea00;
}

.chatbot-header::before {
    content: "🤖" !important;
    font-family: system-ui, "Segoe UI Emoji", "Apple Color Emoji", sans-serif !important;
    width: 30px !important;
    height: 30px !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50%;
    background: #ffea00;
    color: #003d73;
    font-size: 1rem !important;
    line-height: 1 !important;
    flex-shrink: 0;
}

.chatbot-header h4 {
    margin: 0 !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    color: #fff;
}

