/* ============================================================
   CHAT – Mesajlaşma sistemi
   ============================================================ */

/* ── Header ikon düymələri (mesaj + bildiriş) ──────────────── */
.header-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    text-decoration: none;
    transition: background .2s;
}

.header-icon-btn:hover {
    background: rgba(0, 0, 0, .06);
}

.header-icon-btn .fe {
    font-size: 20px;
}

.header-icon-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: #e74c3c;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    pointer-events: none;
}

/* ── Bildirişlər səhifəsi ──────────────────────────────────── */
.notify-page-wrap {
    padding: 32px 0 60px;
}

.notify-page-header {
    margin-bottom: 24px;
}

.notify-page-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notify-page-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notify-page-title .fe {
    color: var(--primary-color, #4e73df);
}

.notify-page-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    background: #e74c3c;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

/* ── Bildiriş siyahısı ─────────────────────────────────────── */
.notify-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notify-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    background: var(--card-bg, #fff);
    border-radius: 12px;
    border: 1px solid var(--border-color, #eee);
    transition: box-shadow .15s;
    position: relative;
}

.notify-item:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, .07);
}

.notify-item.notify-unread {
    background: var(--primary-lightest, #f0f4ff);
    border-color: var(--primary-light, #d0dcff);
}

/* ikon kutu */
.notify-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
}

.notify-icon-wrap.ni-primary {
    background: #eef2ff;
    color: var(--primary-color, #4e73df);
}

.notify-icon-wrap.ni-blue {
    background: #e8f4fd;
    color: #2980b9;
}

.notify-icon-wrap.ni-green {
    background: #eafaf1;
    color: #27ae60;
}

.notify-icon-wrap.ni-orange {
    background: #fef9e7;
    color: #e67e22;
}

.notify-icon-wrap.ni-gray {
    background: #f4f6f7;
    color: #7f8c8d;
}

/* mətn hissəsi */
.notify-body {
    flex: 1;
    min-width: 0;
}

.notify-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    line-height: 1.4;
    color: white;
}

.notify-text {
    font-size: 13px;
    color: var(--text-muted, #666);
    line-height: 1.5;
    margin-bottom: 6px;
}

.notify-action-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color, #4e73df);
    text-decoration: none;
}

.notify-action-link:hover {
    text-decoration: underline;
}

.notify-action-link .fe {
    font-size: 12px;
}

/* tarix + nöqtə */
.notify-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
    padding-top: 2px;
}

.notify-time {
    font-size: 11px;
    color: var(--text-muted, #aaa);
    white-space: nowrap;
}

.notify-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color, #4e73df);
}

/* ── Boş hal ───────────────────────────────────────────────── */
.notify-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted, #bbb);
}

.notify-empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.notify-empty-text {
    font-size: 15px;
}

/* ── Müəllim profil kartı (author.php) ────────────────────── */
.author-profile-card-wrap {
    background: var(--card-bg, #fff);
    padding: 32px 0;
    border-top: 1px solid var(--border-color, #eee);
}

.author-profile-card {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.author-profile-avatar {
    flex-shrink: 0;
}

.author-profile-avatar img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color, #4e73df);
}

.author-profile-avatar-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--primary-color, #4e73df);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 40px;
}

.author-profile-info {
    flex: 1;
    min-width: 200px;
}

.author-profile-name {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
}

.author-profile-role {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--primary-color, #4e73df);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

.author-profile-desc {
    margin: 0;
    color: var(--text-muted, #666);
    font-size: 14px;
    line-height: 1.6;
}

.author-profile-actions {
    margin-left: auto;
}

.author-msg-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

/* ── Chat səhifəsi ────────────────────────────────────────── */
.chat-page-wrap {
    height: calc(100vh - 90px);
    display: flex;
    flex-direction: column;
}

.chat-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    border-top: 1px solid var(--border-color, #e4e6ea);
}

/* ── Sol sidebar ──────────────────────────────────────────── */
.chat-sidebar {
    width: 320px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color, #e4e6ea);
    background: var(--card-bg, #fff);
    overflow: hidden;
}

.chat-sidebar-header {
    padding: 18px 16px 10px;
    border-bottom: 1px solid var(--border-color, #e4e6ea);
}

.chat-sidebar-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.chat-search-wrap {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color, #e4e6ea);
}

.chat-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    background: var(--body-bg, #f5f6fa);
    box-sizing: border-box;
}

.chat-search-input:focus {
    border-color: var(--primary-color, #4e73df);
}

.chat-contacts-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

.chat-contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color, #f0f0f0);
    transition: background .15s;
    position: relative;
}

.chat-contact-item:hover,
.chat-contact-item.active {
    background: var(--primary-light, #eef2ff);
}

.chat-contact-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--primary-color, #4e73df);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
}

.chat-contact-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-contact-body {
    flex: 1;
    min-width: 0;
}

.chat-contact-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-contact-preview {
    font-size: 12px;
    color: var(--text-muted, #888);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.chat-contact-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.chat-contact-time {
    font-size: 11px;
    color: var(--text-muted, #aaa);
}

.chat-unread-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--primary-color, #4e73df);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.chat-loading-state {
    padding: 30px;
    text-align: center;
    color: var(--text-muted, #aaa);
}

.chat-loading-state .fe-loader {
    animation: chat-spin .8s linear infinite;
    font-size: 24px;
}

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

.chat-no-convs {
    padding: 30px 16px;
    text-align: center;
    color: var(--text-muted, #aaa);
    font-size: 13px;
}

/* ── Sağ əsas panel ───────────────────────────────────────── */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--body-bg, #f5f6fa);
    overflow: hidden;
}

.chat-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #bbb);
    gap: 12px;
}

.chat-empty-state .fe {
    font-size: 48px;
}

.chat-empty-state p {
    font-size: 15px;
    margin: 0;
}

/* ── Aktiv söhbət ─────────────────────────────────────────── */
.chat-active {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--card-bg, #fff);
    border-bottom: 1px solid var(--border-color, #e4e6ea);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.chat-back-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: inherit;
    font-size: 20px;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--primary-color, #4e73df);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
}

.chat-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-header-name {
    font-weight: 700;
    font-size: 15px;
}

.chat-header-role {
    font-size: 11px;
    color: var(--primary-color, #4e73df);
    font-weight: 600;
}

/* ── Mesajlar bölgəsi ─────────────────────────────────────── */
.chat-messages-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    scroll-behavior: smooth;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-msg-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.chat-msg-row.sent {
    flex-direction: row-reverse;
}

.chat-bubble-wrap {
    max-width: 65%;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-msg-row.sent .chat-bubble-wrap {
    align-items: flex-end;
}

.chat-bubble {
    display: inline-block;
    padding: 9px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    max-width: 100%;
}

.chat-msg-row.received .chat-bubble {
    background: var(--card-bg, #fff);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}

.chat-msg-row.sent .chat-bubble {
    background: var(--primary-color, #4e73df);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-msg-time {
    font-size: 10px;
    color: var(--text-muted, #aaa);
    padding: 0 4px;
}

.chat-msg-row.sent .chat-msg-time {
    text-align: right;
}

/* ── Mesaj faylları ───────────────────────────────────────── */
.chat-msg-files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.chat-file-item {
    border-radius: 10px;
    overflow: hidden;
    max-width: 220px;
    cursor: pointer;
}

.chat-file-item img {
    display: block;
    max-width: 220px;
    max-height: 180px;
    border-radius: 10px;
    object-fit: cover;
}

.chat-file-doc {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    text-decoration: none;
    background: rgba(0, 0, 0, .06);
    color: inherit;
}

.chat-msg-row.sent .chat-file-doc {
    background: rgba(255, 255, 255, .18);
    color: #fff;
}

.chat-file-doc .fe {
    font-size: 20px;
    flex-shrink: 0;
}

/* ── Fayl önizləmə (göndərmə öncəsi) ────────────────────── */
.chat-file-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 16px;
    background: var(--card-bg, #fff);
    border-top: 1px solid var(--border-color, #e4e6ea);
}

.chat-preview-item {
    position: relative;
    width: 70px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color, #ddd);
    flex-shrink: 0;
}

.chat-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-preview-doc {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 10px;
    background: var(--body-bg, #f5f6fa);
    padding: 4px;
    text-align: center;
    overflow: hidden;
}

.chat-preview-doc .fe {
    font-size: 22px;
    color: var(--primary-color, #4e73df);
}

.chat-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 11px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ── Yazma paneli ─────────────────────────────────────────── */
.chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 14px;
    background: var(--card-bg, #fff);
    border-top: 1px solid var(--border-color, #e4e6ea);
}

.chat-file-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted, #888);
    transition: background .2s, color .2s;
    flex-shrink: 0;
}

.chat-file-btn:hover {
    background: var(--primary-light, #eef2ff);
    color: var(--primary-color, #4e73df);
}

.chat-file-btn .fe {
    font-size: 20px;
}

.chat-textarea-wrap {
    flex: 1;
}

.chat-textarea-wrap textarea {
    width: 100%;
    resize: none;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    font-family: inherit;
    background: var(--body-bg, #f5f6fa);
    box-sizing: border-box;
    max-height: 120px;
    overflow-y: auto;
}

.chat-textarea-wrap textarea:focus {
    border-color: var(--primary-color, #4e73df);
    background: #fff;
}

.chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary-color, #4e73df);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity .2s;
}

.chat-send-btn:hover {
    opacity: .85;
}

.chat-send-btn .fe {
    font-size: 16px;
}

.chat-send-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* ── Tarix ayırıcısı ──────────────────────────────────────── */
.chat-date-divider {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted, #aaa);
    margin: 8px 0;
    position: relative;
}

.chat-date-divider::before,
.chat-date-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 50px);
    height: 1px;
    background: var(--border-color, #e4e6ea);
}

.chat-date-divider::before {
    left: 0;
}

.chat-date-divider::after {
    right: 0;
}

/* ── Responsiv ────────────────────────────────────────────── */
@media (max-width: 700px) {
    .chat-container {
        position: relative;
    }

    .chat-sidebar {
        position: absolute;
        inset: 0;
        width: 100%;
        z-index: 2;
        transition: transform .25s;
    }

    .chat-sidebar.hidden {
        transform: translateX(-100%);
    }

    .chat-main {
        position: absolute;
        inset: 0;
        z-index: 1;
    }

    .chat-back-btn {
        display: inline-flex;
    }

    .author-profile-card {
        flex-direction: column;
    }

    .author-profile-actions {
        margin-left: 0;
    }
}



/* ════════════════════════════════════════
   DARK THEME OVERRIDES
   ════════════════════════════════════════ */

/* Notify items */
.notify-item {
    background: #110e0e;
    border-color: #2e2e2e;
}

.notify-item:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.notify-item.notify-unread {
    background: rgba(78, 115, 223, 0.1);
    border-color: rgba(78, 115, 223, 0.25);
}

/* Notify icon backgrounds */
.notify-icon-wrap.ni-primary {
    background: rgba(78, 115, 223, 0.15);
}

.notify-icon-wrap.ni-blue {
    background: rgba(41, 128, 185, 0.15);
}

.notify-icon-wrap.ni-green {
    background: rgba(39, 174, 96, 0.15);
}

.notify-icon-wrap.ni-orange {
    background: rgba(230, 126, 34, 0.15);
}

.notify-icon-wrap.ni-gray {
    background: rgba(127, 140, 141, 0.15);
}

/* Author profile card */
.author-profile-card-wrap {
    background: #110e0e;
    border-top-color: #2e2e2e;
}

.author-profile-desc {
    color: #aaa;
}

/* Chat sidebar */
.chat-sidebar {
    background: #1a1a1a;
    border-right-color: #2e2e2e;
}

.chat-sidebar-header {
    border-bottom-color: #2e2e2e;
}

.chat-sidebar-header h3 {
    color: #e5e5e5;
}

.chat-search-wrap {
    border-bottom-color: #2e2e2e;
}

.chat-search-input {
    background: #141414;
    border-color: #333;
    color: #e5e5e5;
}

/* Contact list */
.chat-contact-item {
    border-bottom-color: #2a2a2a;
}

.chat-contact-item:hover,
.chat-contact-item.active {
    background: rgba(78, 115, 223, 0.12);
}

.chat-contact-name {
    color: #e5e5e5;
}

/* Chat main area */
.chat-main {
    background: #141414;
}

/* Active chat header */
.chat-header {
    background: #1a1a1a;
    border-bottom-color: #2e2e2e;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.chat-header-name {
    color: #e5e5e5;
}

/* Received messages */
.chat-msg-row.received .chat-bubble {
    background: #110e0e;
    color: #e5e5e5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Date divider */
.chat-date-divider::before,
.chat-date-divider::after {
    background: #2e2e2e;
}

/* File preview bar */
.chat-file-previews {
    background: #1a1a1a;
    border-top-color: #2e2e2e;
}

.chat-preview-item {
    border-color: #383838;
}

.chat-preview-doc {
    background: #141414;
    color: #aaa;
}

/* Input area */
.chat-input-area {
    background: #1a1a1a;
    border-top-color: #2e2e2e;
}

.chat-textarea-wrap textarea {
    background: #141414;
    border-color: #333;
    color: #e5e5e5;
}

.chat-textarea-wrap textarea:focus {
    background: #110e0e;
}

.chat-textarea-wrap textarea::placeholder {
    color: #555;
}

/* Header icon button */
.header-icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}