/* ==========================================================================
   Islamic Scenario - Noor AI Chatbot Stylesheet
   Modern Glassmorphic Islamic Academy Assistant
   ========================================================================== */

:root {
    --chat-primary: #0b2239;
    --chat-primary-dark: #071726;
    --chat-accent-gold: #dfa929;
    --chat-accent-gold-hover: #f5ba31;
    --chat-accent-emerald: #10b981;
    --chat-bg-glass: rgba(255, 255, 255, 0.98);
    --chat-user-bubble: linear-gradient(135deg, #0e3b68 0%, #0b2239 100%);
    --chat-bot-bubble: #f4f7fb;
    --chat-text-dark: #1e293b;
    --chat-text-muted: #64748b;
    --chat-border: rgba(223, 169, 41, 0.25);
    --chat-shadow: 0 20px 60px rgba(11, 34, 57, 0.22), 0 0 0 1px rgba(223, 169, 41, 0.2);
}

/* ==========================================
   Chat Floating Launcher Button & Tooltip
   ========================================== */
.noor-chat-widget-root {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.noor-chat-launcher {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0b2239 0%, #154570 100%);
    border: 2px solid #dfa929;
    box-shadow: 0 8px 25px rgba(11, 34, 57, 0.4), 0 0 20px rgba(223, 169, 41, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    outline: none;
}

.noor-chat-launcher:hover {
    transform: scale(1.08) translateY(-3px);
    box-shadow: 0 12px 32px rgba(11, 34, 57, 0.5), 0 0 28px rgba(223, 169, 41, 0.55);
}

.noor-chat-launcher:active {
    transform: scale(0.96);
}

.noor-launcher-pulse {
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    border: 2px solid rgba(223, 169, 41, 0.6);
    animation: noor-pulse 2.4s cubic-bezier(0.24, 0, 0.38, 1) infinite;
    pointer-events: none;
}

@keyframes noor-pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.25);
        opacity: 0;
    }
    100% {
        transform: scale(1.25);
        opacity: 0;
    }
}

.noor-launcher-icon-open,
.noor-launcher-icon-close {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.noor-launcher-icon-open {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.noor-launcher-icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.noor-chat-widget-root.is-open .noor-launcher-icon-open {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.noor-chat-widget-root.is-open .noor-launcher-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.noor-chat-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #10b981;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.noor-chat-badge.hidden {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

/* Tooltip / Prompt Bubble */
.noor-proactive-tooltip {
    position: absolute;
    bottom: calc(100% + 14px);
    right: 0;
    width: 290px;
    background: #0b2239;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(223, 169, 41, 0.35);
    font-size: 13px;
    line-height: 1.45;
    cursor: pointer;
    opacity: 0;
    transform: translateY(12px) scale(0.95);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
}

.noor-proactive-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.noor-proactive-tooltip::after {
    content: '';
    position: absolute;
    bottom: -7px;
    right: 24px;
    width: 14px;
    height: 14px;
    background: #0b2239;
    transform: rotate(45deg);
    border-bottom: 1px solid rgba(223, 169, 41, 0.35);
    border-right: 1px solid rgba(223, 169, 41, 0.35);
}

.noor-tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    font-weight: 700;
    color: #dfa929;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.noor-tooltip-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
}

.noor-tooltip-close:hover {
    color: #ffffff;
}

.noor-tooltip-body {
    color: #e2e8f0;
}

/* ==========================================
   Chat Window Container
   ========================================== */
.noor-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 620px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 24px;
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(223, 169, 41, 0.3);
}

.noor-chat-widget-root.is-open .noor-chat-window {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ==========================================
   Chat Header
   ========================================== */
.noor-chat-header {
    background: linear-gradient(135deg, #091e33 0%, #0c2b4a 60%, #154570 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1.5px solid rgba(223, 169, 41, 0.3);
    color: #ffffff;
    flex-shrink: 0;
    position: relative;
}

.noor-header-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.noor-avatar-wrapper {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    padding: 2px;
    border: 2px solid #dfa929;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.noor-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.noor-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 11px;
    height: 11px;
    background: #10b981;
    border-radius: 50%;
    border: 2px solid #091e33;
}

.noor-header-details {
    display: flex;
    flex-direction: column;
}

.noor-header-name {
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.2;
}

.noor-verified-sparkle {
    color: #dfa929;
    font-size: 13px;
}

.noor-header-status {
    font-size: 12px;
    color: #dfa929;
    font-weight: 600;
    letter-spacing: 0.2px;
    margin-top: 2px;
}

.noor-header-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.noor-ctrl-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.noor-ctrl-btn:hover {
    background: rgba(223, 169, 41, 0.25);
    color: #dfa929;
    border-color: rgba(223, 169, 41, 0.4);
    transform: translateY(-1px);
}

.noor-ctrl-btn svg {
    width: 15px;
    height: 15px;
}

/* ==========================================
   Chat Messages Scroll Area
   ========================================== */
.noor-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(11, 34, 57, 0.25) transparent;
}

.noor-messages-container::-webkit-scrollbar {
    width: 5px;
}

.noor-messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.noor-messages-container::-webkit-scrollbar-thumb {
    background: rgba(11, 34, 57, 0.25);
    border-radius: 4px;
}

.noor-messages-container::-webkit-scrollbar-thumb:hover {
    background: #dfa929;
}

/* Message Rows */
.noor-msg-row {
    display: flex;
    gap: 10px;
    max-width: 88%;
    animation: noor-fade-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes noor-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.noor-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #0b2239;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1.5px solid #dfa929;
    overflow: hidden;
}

.noor-msg-avatar img {
    width: 85%;
    height: 85%;
    object-fit: contain;
}

.noor-msg-content-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.noor-msg-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.55;
    word-break: break-word;
}

.noor-msg-row.bot .noor-msg-bubble {
    background: var(--chat-bot-bubble);
    color: var(--chat-text-dark);
    border: 1px solid rgba(11, 34, 57, 0.08);
    border-top-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.noor-msg-row.user .noor-msg-bubble {
    background: var(--chat-user-bubble);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 14px rgba(11, 34, 57, 0.25);
}

.noor-msg-time {
    font-size: 10.5px;
    color: var(--chat-text-muted);
    align-self: flex-start;
    padding: 0 4px;
}

.noor-msg-row.user .noor-msg-time {
    align-self: flex-end;
}

/* Rich Text Inside Bubbles */
.noor-msg-bubble p {
    margin: 0 0 8px 0;
}

.noor-msg-bubble p:last-child {
    margin-bottom: 0;
}

.noor-msg-bubble ul,
.noor-msg-bubble ol {
    margin: 6px 0 8px 18px;
    padding: 0;
}

.noor-msg-bubble li {
    margin-bottom: 4px;
}

.noor-msg-bubble strong {
    font-weight: 700;
    color: #0b2239;
}

.noor-msg-row.user .noor-msg-bubble strong {
    color: #dfa929;
}

.noor-msg-bubble a {
    color: #0b5c9e;
    text-decoration: underline;
    font-weight: 600;
}

.noor-msg-row.user .noor-msg-bubble a {
    color: #dfa929;
}

/* Embedded Action Chips & Buttons */
.noor-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.noor-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.noor-action-btn.gold {
    background: #dfa929;
    color: #0b2239;
    box-shadow: 0 2px 8px rgba(223, 169, 41, 0.3);
}

.noor-action-btn.gold:hover {
    background: #eab308;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(223, 169, 41, 0.45);
}

.noor-action-btn.green {
    background: #10b981;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.noor-action-btn.green:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.45);
}

.noor-action-btn.blue {
    background: #0b3a82;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(11, 58, 130, 0.3);
}

.noor-action-btn.blue:hover {
    background: #0d469e;
    transform: translateY(-1px);
}

/* Quick Prompts Panel (Welcome Suggestions) */
.noor-quick-prompts-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 4px 0 10px 0;
}

.noor-quick-prompts-title {
    font-size: 11.5px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.noor-quick-prompts-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.noor-prompt-chip {
    background: #ffffff;
    border: 1px solid rgba(223, 169, 41, 0.4);
    color: #0b2239;
    padding: 9px 13px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.noor-prompt-chip:hover {
    background: #fdfaf2;
    border-color: #dfa929;
    transform: translateX(3px);
    box-shadow: 0 3px 10px rgba(223, 169, 41, 0.15);
}

.noor-prompt-chip .chip-arrow {
    color: #dfa929;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.noor-prompt-chip:hover .chip-arrow {
    transform: translateX(2px);
}

/* Typing Indicator Animation */
.noor-typing-indicator {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--chat-bot-bubble);
    border: 1px solid rgba(11, 34, 57, 0.08);
    border-radius: 18px;
    border-top-left-radius: 4px;
    width: fit-content;
}

.noor-typing-indicator.active {
    display: flex;
}

.noor-typing-dot {
    width: 7px;
    height: 7px;
    background: #0b2239;
    border-radius: 50%;
    opacity: 0.4;
    animation: noor-typing 1.4s infinite;
}

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

@keyframes noor-typing {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-5px);
        opacity: 1;
        background: #dfa929;
    }
}

/* ==========================================
   Chat Input Section
   ========================================== */
.noor-chat-input-wrapper {
    padding: 12px 16px 16px 16px;
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.noor-input-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    padding: 6px 8px 6px 14px;
    transition: all 0.25s ease;
}

.noor-input-form:focus-within {
    border-color: #dfa929;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(223, 169, 41, 0.15);
}

.noor-chat-textarea {
    flex: 1;
    border: none !important;
    background: transparent !important;
    font-family: inherit;
    font-size: 14px;
    color: var(--chat-text-dark);
    resize: none;
    max-height: 100px;
    min-height: 24px;
    outline: none !important;
    box-shadow: none !important;
    line-height: 1.4;
    padding: 6px 0;
    margin: 0;
}

.noor-chat-textarea:focus,
.noor-chat-textarea:focus-visible {
    outline: none !important;
    outline-offset: 0 !important;
    box-shadow: none !important;
    border: none !important;
}

.noor-chat-textarea::placeholder {
    color: #94a3b8;
}

.noor-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #0b2239;
    color: #dfa929;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    outline: none !important;
}

.noor-send-btn:focus-visible,
.noor-ctrl-btn:focus-visible,
.noor-prompt-chip:focus-visible,
.noor-action-btn:focus-visible {
    outline: 2px solid #dfa929 !important;
    outline-offset: 1px !important;
}

.noor-send-btn:hover:not(:disabled) {
    background: #dfa929;
    color: #0b2239;
    transform: scale(1.05);
}

.noor-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.noor-send-btn svg {
    width: 16px;
    height: 16px;
    margin-left: 2px;
}

.noor-footer-powered {
    text-align: center;
    font-size: 10px;
    color: #94a3b8;
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.noor-footer-powered a {
    color: #0b3a82;
    text-decoration: none;
    font-weight: 700;
}

/* ==========================================
   Responsive Adaptations
   ========================================== */
@media (max-width: 600px) {
    .noor-chat-widget-root {
        bottom: 16px;
        right: 16px;
    }

    .noor-chat-launcher {
        width: 56px;
        height: 56px;
    }

    .noor-proactive-tooltip {
        width: calc(100vw - 32px);
        max-width: 320px;
        right: 0;
    }

    .noor-chat-window {
        position: absolute !important;
        bottom: 68px !important;
        right: 0 !important;
        left: auto !important;
        top: auto !important;
        width: calc(100vw - 32px) !important;
        max-width: 360px !important;
        height: 500px !important;
        max-height: calc(100vh - 100px) !important;
        border-radius: 20px !important;
        border: 1px solid rgba(223, 169, 41, 0.35) !important;
        box-shadow: 0 16px 45px rgba(11, 34, 57, 0.35) !important;
    }

    .noor-chat-header {
        border-radius: 20px 20px 0 0 !important;
        padding: 13px 16px !important;
    }
}
