/* Faz 6b: teslim tarihi uyarıları — üst çubuktaki zil, açılır uyarı listesi ve bildirim ayarları penceresi. */

/* ---------- Zil ---------- */
.ntf-bell {
    position: relative;
    flex-shrink: 0;
    width: 32px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: var(--bg-shell);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ntf-bell[hidden] { display: none; }
.ntf-bell:hover, .ntf-bell[aria-expanded="true"] { background: var(--border-subtle); color: var(--text-primary); }
.ntf-bell.has-unread { color: var(--accent-purple); border-color: rgba(124, 58, 237, 0.35); }
.ntf-bell:focus-visible { outline: 2px solid var(--accent-purple); outline-offset: 2px; }
.ntf-bell svg { width: 16px; height: 16px; }
.ntf-badge {
    position: absolute;
    top: -7px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    border: 2px solid var(--bg-shell);
    background: var(--accent-rose);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
    pointer-events: none;
}
.ntf-badge[hidden] { display: none; }

/* ---------- Açılır liste ---------- */
.ntf-panel {
    position: fixed;
    z-index: 145; /* geri bildirim düğmesinin (140) üstünde, pencerelerin (150+) altında */
    width: 420px;
    max-width: calc(100vw - 16px);
    max-height: min(600px, calc(100vh - 90px));
    display: flex;
    flex-direction: column;
    background: var(--bg-shell);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.28), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    font-family: var(--font-sans);
    font-size: 12.5px;
}
.ntf-panel[hidden] { display: none; }
.ntf-panel:focus { outline: none; }

.ntf-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 12px 12px 10px 16px;
    border-bottom: 1px solid var(--border-light);
}
/* Dar ekranda başlık tek satırda kalır, düğmeler alt satıra iner. */
.ntf-head-title { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.ntf-count {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--accent-purple);
    background: var(--accent-purple-light);
    border-radius: 999px;
    padding: 1px 7px;
}
.ntf-head-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; margin-left: auto; }
.ntf-link {
    border: none;
    background: transparent;
    color: var(--accent-purple);
    font: inherit;
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 8px;
    border-radius: 7px;
    cursor: pointer;
}
.ntf-link:hover { background: var(--accent-purple-light); }
.ntf-link:disabled { color: var(--text-muted); background: transparent; cursor: default; }
.ntf-icon-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
}
.ntf-icon-btn:hover { background: var(--border-subtle); color: var(--text-primary); }
.ntf-icon-btn svg { width: 15px; height: 15px; }
.ntf-link:focus-visible, .ntf-icon-btn:focus-visible, .ntf-row:focus-visible, .ntf-btn:focus-visible {
    outline: 2px solid var(--accent-purple);
    outline-offset: -2px;
}

.ntf-paused, .ntf-error {
    margin: 10px 12px 0;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 11.5px;
}
.ntf-paused { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.ntf-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

.ntf-list { flex: 1; overflow-y: auto; padding: 4px 0 6px; overscroll-behavior: contain; }
.ntf-empty { color: var(--text-muted); font-size: 12px; padding: 22px 16px; text-align: center; }
.ntf-group + .ntf-group { border-top: 1px solid var(--border-subtle); }
.ntf-group-h {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 9px 16px 5px;
    background: var(--bg-shell);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.ntf-group-overdue { color: #e11d48; }
.ntf-group-n { color: var(--text-muted); font-weight: 600; margin-left: 2px; }
.ntf-ul { list-style: none; margin: 0; padding: 0; }

.ntf-row {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 16px 9px 12px;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s;
}
.ntf-row:hover { background: var(--sidebar-item-hover, #f1f4f8); }
.ntf-row.is-unread { background: rgba(124, 58, 237, 0.045); }
.ntf-row.is-unread:hover { background: rgba(124, 58, 237, 0.09); }
.ntf-dot { flex-shrink: 0; width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: transparent; }
.ntf-row.is-unread .ntf-dot { background: var(--accent-purple); }
.ntf-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.ntf-row-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ntf-proj {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.ntf-type {
    flex-shrink: 0;
    font-size: 9.5px;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    padding: 0 6px;
}
.ntf-row-title {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.35;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ntf-row.is-unread .ntf-row-title { font-weight: 650; }
.ntf-row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 11px; color: var(--text-muted); }
.ntf-when { font-weight: 700; border-radius: 6px; padding: 1px 7px; }
.ntf-when-overdue { color: #be123c; background: #fff1f2; }
.ntf-when-soon { color: #b45309; background: #fffbeb; }
.ntf-when-later { color: #1d4ed8; background: #eff6ff; }
.ntf-when-done { color: #047857; background: #ecfdf5; }
.ntf-foot {
    padding: 8px 16px 10px;
    border-top: 1px solid var(--border-light);
    font-size: 10.5px;
    color: var(--text-muted);
}
.ntf-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

body.dark-mode .ntf-when-overdue { color: #fda4af; background: rgba(244, 63, 94, 0.15); }
body.dark-mode .ntf-when-soon { color: #fcd34d; background: rgba(245, 158, 11, 0.15); }
body.dark-mode .ntf-when-later { color: #93c5fd; background: rgba(37, 99, 235, 0.18); }
body.dark-mode .ntf-when-done { color: #6ee7b7; background: rgba(16, 185, 129, 0.15); }
body.dark-mode .ntf-group-overdue { color: #fb7185; }
body.dark-mode .ntf-paused { background: rgba(245, 158, 11, 0.12); color: #fcd34d; border-color: rgba(245, 158, 11, 0.3); }
body.dark-mode .ntf-error { background: rgba(244, 63, 94, 0.12); color: #fda4af; border-color: rgba(244, 63, 94, 0.3); }

/* ---------- Ayarlar penceresi ---------- */
.ntf-overlay {
    position: fixed;
    inset: 0;
    z-index: 160;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
    font-family: var(--font-sans);
}
.ntf-overlay[hidden] { display: none; }
body.test-mode .ntf-overlay { top: 30px; }
.ntf-modal {
    width: 620px;
    max-width: 100%;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    background: var(--bg-shell);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    font-size: 12.5px;
}
body.test-mode .ntf-modal { max-height: calc(100vh - 62px); }
.ntf-modal:focus { outline: none; }
.ntf-modal-loading { padding: 30px; }
.ntf-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px 12px 20px;
    border-bottom: 1px solid var(--border-light);
}
.ntf-modal-title { font-size: 15px; font-weight: 700; }
.ntf-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.ntf-modal-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--sidebar-bg);
}
.ntf-form-err { flex: 1 1 100%; color: #b91c1c; font-size: 12px; font-weight: 600; }
.ntf-form-err[hidden] { display: none; }

.ntf-fields { border: none; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.ntf-section {
    border: 1px solid var(--border-light);
    border-radius: 12px;
    margin: 0;
    padding: 10px 14px 12px;
    min-width: 0;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ntf-section legend {
    padding: 0 6px;
    margin-left: -6px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}
.ntf-hint { font-size: 11.5px; color: var(--text-muted); }
.ntf-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.ntf-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12.5px; }
.ntf-check input { width: 15px; height: 15px; accent-color: var(--accent-purple); margin: 0; }
.ntf-pause { align-items: flex-start; padding: 2px 2px; }
.ntf-pause input { margin-top: 2px; }
.ntf-pause b { display: block; font-weight: 600; }
.ntf-pause small { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

.ntf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.ntf-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ntf-field > span { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
.ntf-field-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ntf-modal select, .ntf-modal input[type="text"], .ntf-modal input[type="email"], .ntf-modal input[type="date"] {
    font: inherit;
    font-size: 12.5px;
    color: var(--text-primary);
    background: var(--bg-shell);
    border: 1px solid var(--border-light);
    border-radius: 7px;
    padding: 5px 8px;
    min-height: 31px;
    min-width: 0;
    width: 100%;
}
.ntf-modal input:focus, .ntf-modal select:focus { outline: 2px solid var(--accent-purple-light); border-color: var(--accent-purple); }
.ntf-modal .ntf-invalid { border-color: #dc2626; background: #fef2f2; }
body.dark-mode .ntf-modal .ntf-invalid { background: rgba(220, 38, 38, 0.1); }
.ntf-field-err { color: #b91c1c; font-size: 11.5px; font-weight: 600; }
.ntf-field-err[hidden] { display: none; }
.ntf-fields:disabled .ntf-check, .ntf-fields:disabled select, .ntf-fields:disabled input { cursor: not-allowed; opacity: 0.75; }

.ntf-proj-list { display: flex; flex-direction: column; max-height: 230px; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.ntf-proj-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px 140px;
    align-items: center;
    gap: 4px 8px;
    padding: 5px 0;
    border-bottom: 1px solid var(--border-subtle);
}
.ntf-proj-row:last-child { border-bottom: none; }
.ntf-proj-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ntf-proj-row .ntf-proj-days[hidden] { display: none; }
.ntf-proj-row .ntf-field-err { grid-column: 1 / -1; }

.ntf-note { border-radius: 8px; padding: 8px 11px; font-size: 12px; line-height: 1.45; }
.ntf-note-email { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.ntf-note-readonly { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; font-weight: 600; }
body.dark-mode .ntf-note-email { background: rgba(37, 99, 235, 0.14); color: #bfdbfe; border-color: rgba(37, 99, 235, 0.35); }
body.dark-mode .ntf-note-readonly { background: rgba(245, 158, 11, 0.12); color: #fcd34d; border-color: rgba(245, 158, 11, 0.35); }

.ntf-admin { border-style: dashed; border-color: #c4b5fd; background: var(--accent-purple-light); }
.ntf-inline { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px 10px; }
.ntf-field-inline { width: 170px; }
.ntf-run-result { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.ntf-run-result:empty { display: none; }
.ntf-run-result.is-error { color: #b91c1c; }

.ntf-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: var(--bg-shell);
    color: var(--text-secondary);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}
.ntf-btn:hover { background: var(--border-subtle); color: var(--text-primary); }
.ntf-btn-primary { background: #0f172a; border-color: #0f172a; color: #fff; }
.ntf-btn-primary:hover { background: #1e293b; color: #fff; }
body.dark-mode .ntf-btn-primary { background: #fff; border-color: #fff; color: #0f172a; }
.ntf-btn:disabled, .ntf-btn:disabled:hover { opacity: 0.55; cursor: not-allowed; }

/* ---------- Dar ekran ---------- */
@media (max-width: 760px) {
    /* Üst çubuğun sağı dar ekranda taşar: zil pencerenin sağ üst köşesine sabitlenir. */
    .ntf-bell {
        position: fixed;
        top: 22px;
        right: 26px;
        width: 38px;
        height: 36px;
        box-shadow: var(--shadow-card);
    }
    body.test-mode .ntf-bell { top: 52px; }
    .ntf-panel { max-height: calc(100vh - 80px); }
    .ntf-grid { grid-template-columns: minmax(0, 1fr); }
    .ntf-proj-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .ntf-proj-name { grid-column: 1 / -1; }
    .ntf-modal-body { padding: 14px; }
    .ntf-modal-head, .ntf-modal-foot { padding-left: 14px; padding-right: 14px; }
}
