/* ============================================================
   ArabGPT v1.0.0  |  app.css
   Global custom styles layered on top of Tailwind.
   ============================================================ */

/* ── Page transition loader ── */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}
.page-loader.loader-hide {
    opacity: 0;
    pointer-events: none;
}
.loader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
.loader-logo {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    object-fit: contain;
    animation: loaderPulse 1.6s ease-in-out infinite;
}
@keyframes loaderPulse {
    0%, 100% { transform: scale(1);   opacity: 1;   }
    50%       { transform: scale(.92); opacity: .75; }
}
.loader-dots {
    display: flex;
    align-items: center;
    gap: 6px;
}
.loader-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3b82f6;
    animation: dotBounce 1.1s infinite ease-in-out both;
}
.loader-dots span:nth-child(1) { animation-delay: 0s;    }
.loader-dots span:nth-child(2) { animation-delay: 0.18s; }
.loader-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes dotBounce {
    0%, 80%, 100% { transform: translateY(0);   opacity: .4; }
    40%            { transform: translateY(-6px); opacity: 1; }
}


*, *::before, *::after {
    font-family: 'Montserrat', 'Noto Sans Arabic', sans-serif;
    box-sizing: border-box;
}

/* ── Arabic/Persian text auto-detection class (applied by JS) ── */
.text-arabic {
    font-family: 'Noto Sans Arabic', sans-serif !important;
    direction: rtl;
    text-align: right;
    line-height: 2;
    letter-spacing: 0;
}
/* Textarea typed in Arabic */
textarea.text-arabic {
    unicode-bidi: plaintext;   /* let browser auto-detect per line */
}

/* ── Scrollbar ── */
::-webkit-scrollbar          { width: 4px; height: 4px; }
::-webkit-scrollbar-track    { background: transparent; }
::-webkit-scrollbar-thumb    { background: #e2e8f0; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* ── Textarea auto-resize ── */
#message-input { overflow-y: hidden; }

/* ── Send-btn spin animation ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; }

/* ── Chat message entrance ── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.chat-message { animation: fadeUp 0.22s ease-out both; }

/* ── Typing indicator dots ── */
.typing-dot {
    width: 5px; height: 5px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingBounce 1.1s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40%            { transform: translateY(-4px); }
}

/* ── Suggestion chips ── */
.suggestion-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.45rem 0.9rem;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: border-color 0.18s, color 0.18s, transform 0.18s, box-shadow 0.18s;
    font-family: 'Montserrat', sans-serif;
}
.suggestion-chip:hover {
    border-color: #3b82f6;
    color: #2563eb;
    background: #eff6ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.12);
}

/* ── AI message Markdown styles ── */
.ai-content code {
    background: #f1f5f9;
    color: #dc2626;
    padding: 0.1em 0.35em;
    border-radius: 4px;
    font-size: 0.82em;
    font-family: 'Courier New', Courier, monospace;
}
.ai-content pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 12px;
    overflow-x: auto;
    font-size: 0.78rem;
    margin: 0.6rem 0;
    line-height: 1.65;
}
.ai-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
}
.ai-content strong  { font-weight: 700; color: #1e293b; }
.ai-content em      { font-style: italic; }
.ai-content ul,
.ai-content ol      { padding-left: 1.25rem; margin: 0.4rem 0; }
.ai-content li      { margin: 0.2rem 0; }
.ai-content p + p   { margin-top: 0.5rem; }

/* ── Notification filter tabs ── */
.filter-tab {
    color: #64748b;
    border-bottom: 2px solid transparent;
    background: none;
    cursor: pointer;
    white-space: nowrap;
}
.filter-tab:hover  { color: #1e293b; }
.filter-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

/* ── Notification card entrance ── */
.notification-card { animation: fadeUp 0.2s ease-out both; }

/* ── Sidebar on mobile: smooth slide ── */
.sidebar { will-change: transform; }

/* ── Message meta: time + copy ── */
.copy-btn {
    opacity: 0;
    transition: opacity 0.15s;
}
.chat-message:hover .copy-btn {
    opacity: 1;
}

/* ── Show more / expand long messages ── */
.bubble {
    transition: max-height 0.3s ease;
}
.show-more-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    pointer-events: none;
    border-radius: 0 0 1rem 1rem;
}
.show-more-btn {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 12px;
    border-radius: 99px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(4px);
    white-space: nowrap;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.15s;
}
.show-more-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* ── Input box: Claude-style row layout ── */
.input-box {
    display: flex;
    flex-direction: column;
}
.input-box textarea {
    outline: none;
    box-shadow: none;
}
.input-box textarea:focus {
    outline: none;
    box-shadow: none;
}
.input-box textarea::-webkit-scrollbar { width: 3px; }
.input-box textarea::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }

/* File preview strip */
#file-preview-strip {
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px 6px;
    border-bottom: 1px solid #f1f5f9;
}

/* ── Input field with embedded send button ── */
.input-field {
    /* pr-14 leaves room for the 36px button + 8px gap on the right */
}

/* ── Sidebar chat items: action buttons on hover ── */
.chat-item .rename-btn,
.chat-item .delete-btn {
    /* Tailwind handles visibility via group-hover, but ensure no layout shift */
    flex-shrink: 0;
}

/* ── Text selection → Ask ArabGPT button ── */
#ask-arabgpt-btn {
    pointer-events: auto;
    user-select: none;
    animation: fadeUp 0.12s ease-out both;
}

/* ── Quote chip in preview strip ── */
#quote-chip .line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Voice recording waveform ── */
.waveform-bar {
    height: 4px;
    min-height: 4px;
    max-height: 32px;
    border-radius: 99px;
    background: #3b82f6;
    transition: height 0.05s ease;
    transform-origin: bottom;
}

/* Recording overlay pulsing border */
#recording-overlay {
    animation: recordPulse 2s ease-in-out infinite;
}
@keyframes recordPulse {
    0%, 100% { box-shadow: 0 0 0 0   rgba(239, 68, 68, 0);   }
    50%       { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); }
}

/* ── Generated image bubble ── */
.ai-content img.generated-img {
    border-radius: 12px;
    max-width: 100%;
    display: block;
}

/* ── Image lightbox entrance ── */
#img-lightbox {
    animation: fadeIn 0.15s ease;
}
#img-lightbox img {
    animation: scaleIn 0.2s ease;
}

/* ── Rename modal backdrop click ── */
#rename-modal { animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
#rename-modal > div { animation: scaleIn 0.15s ease; }
@keyframes scaleIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ── Date input light style fix (webkit) ── */
input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0.5;
    cursor: pointer;
}
