/* Comments */
.comment-form {
    background: #f8fafc;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.comment-item {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.comment-item.internal {
    background: #fef3c7;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.comment-author {
    font-weight: 600;
    font-size: 14px;
}

.comment-text {
    font-size: 14px;
    color: #475569;
    line-height: 1.7;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    z-index: 10001;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 24px;
}

@media (max-width: 480px) {
    .modal-actions .btn {
        flex: 1 1 100%;
    }
}

/* Toast */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    /* סולם שכבות: drawer 1000 < modal 10000 < action-loader 10050
       < toast 10055 < confirm/prompt/bulkError 10060.
       הטוסט מעל הלואדר (גלוי בזמן טעינה) אבל *מתחת* לדיאלוגי
       confirm/prompt — אחרת כפתור פעולה בטוסט (undo דחייה) היה
       לחיץ מעל מודאל וניתן לשנות סטטוס "דרך" דיאלוג. */
    z-index: 10055;
}

/* בהתחזות באנר בגובה 52px יושב ב-top:0 — מזיזים את הטוסטים מתחתיו כדי לא לכסותו */
body.impersonating .toast-container {
    top: 72px;
}

/* כשהלואדר החוסם פתוח: הטוסט נשאר גלוי (מעל הלואדר) אבל לא-אינטראקטיבי,
   כדי שכפתור פעולה בטוסט (undo דחייה) לא יופעל "מעל" פעולה שהלואדר חוסם.
   לדיאלוגי confirm/prompt (z-index 10060) אין צורך בזה — הם מכסים את
   הטוסט (10055) ותופסים את הקליק ממילא. */
body.al-blocking .toast-container {
    pointer-events: none;
}

.toast {
    background: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 12px;
    display: flex;
    gap: 12px;
    min-width: 300px;
}

.toast.success {
    border-right: 3px solid #10b981;
}

.toast.error {
    border-right: 3px solid #ef4444;
}

.toast.info {
    border-right: 3px solid #3b82f6;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f4f6;
    border-top: 6px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.activity-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.activity-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

#refreshActivityBtn.is-refreshing {
    pointer-events: none;
    opacity: 0.7;
}

#refreshActivityBtn.is-refreshing svg {
    animation: spin 0.8s linear infinite;
}

/* מובייל צר: כפתור הרענון מצטמצם לאייקון בלבד (aria-label נשאר לקוראי מסך) */
@media (max-width: 560px) {
    #refreshActivityBtn {
        padding-inline: 12px;
    }

    #refreshActivityBtn .refresh-btn-label {
        display: none;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-card {
    background: #fef3c7;
    border-right: 3px solid #f59e0b;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
}

.alert-card:hover {
    background: #fde68a;
}

.alert-title {
    font-weight: 600;
    font-size: 14px;
    color: #92400e;
    margin-bottom: 4px;
}

.alert-text {
    font-size: 13px;
    color: #92400e;
}

.request-drop-zone {
    border: 1.5px dashed #cbd5e1;
    border-radius: 10px;
    padding: 14px 16px;
    min-height: 86px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    background: #f8fafc;
    transition: all .2s ease;
}

.request-drop-zone:hover,
.request-drop-zone.is-dragover {
    border-color: #667eea;
    background: #eef2ff;
}

.request-drop-zone-icon {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
}

.request-drop-zone-text {
    color: #334155;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
}

.request-drop-zone-hint {
    font-size: 11px;
    color: #5a6779;
}

/* Upload Progress */
.upload-queue {
    margin-top: 10px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.upload-item {
    padding: 10px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 0;
}

.upload-item-meta {
    min-width: 0;
    flex: 1;
}

.upload-item-name {
    font-size: 13px;
    color: #1e293b;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-item-sub {
    margin-top: 2px;
    font-size: 11px;
    color: #64748b;
}

.upload-item-status {
    font-size: 11px;
    font-weight: 700;
    color: #4f46e5;
    background: #eef2ff;
    border-radius: 999px;
    padding: 3px 8px;
    white-space: nowrap;
}

.upload-item-status.status-existing {
    background: #f1f5f9;
    color: #475569;
}

.upload-item-remove {
    border: none;
    background: #fee2e2;
    color: #b91c1c;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
}

.upload-progress {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s;
    border-radius: 3px;
}

/* Skeleton Loaders */
.skeleton {
    background: linear-gradient(90deg,
            #f0f0f0 25%,
            #e0e0e0 50%,
            #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.skeleton-card {
    height: 120px;
    margin-bottom: 12px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    border-color: #667eea;
    color: #5a67d8;
}

.pagination button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Confirm / Prompt Modal ── */
.confirm-modal-box {
    background: white;
    border-radius: 14px;
    padding: 28px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.confirm-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
}

.confirm-modal-message {
    font-size: 14px;
    color: #64748b;
    line-height: 1.65;
    margin-bottom: 20px;
    white-space: pre-wrap;
}

.prompt-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.prompt-modal-message {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 12px;
}

.confirm-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ── Bulk checkbox ──
   הגודל והגוון נקבעים ב-.req-check שב-requests-grid.css, מקור אחד לכולם.
   כאן נשאר רק מה שנוגע להתנהגות בתוך השורה. */
.bulk-checkbox {
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Empty state ── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 24px;
    color: #5a6779;
    text-align: center;
    gap: 12px;
}

.empty-state-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    opacity: 0.55;
    stroke-width: 1.8;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: #475569;
}

.empty-state-subtitle {
    font-size: 13px;
    color: #5a6779;
    margin-top: -4px;
}

/* ── Select All header row ── */
.bulk-select-all-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 10px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    color: #64748b;
}

/* ── Filter count badge ── */
.filter-result-count {
    font-size: 12px;
    color: #475569;
    padding: 3px 10px;
    background: #f1f5f9;
    border-radius: 999px;
    font-weight: 500;
}

/* ── 1024px sidebar collapse ── */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    .main-content {
        margin-right: 220px;
    }
    .sidebar.collapsed ~ .main-content {
        margin-right: 64px;
    }

    .sidebar-header h2 {
        font-size: 14px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .request-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .request-field--title {
        grid-column: 1 / -1;
        order: 1;
    }

    .request-field--institution {
        order: 2;
    }

    .request-field--category {
        order: 3;
    }

    .request-field--urgency {
        order: 4;
    }

    .request-field--quantity {
        order: 5;
    }

    .request-field--institution,
    .request-field--category,
    .request-field--urgency,
    .request-field--quantity {
        grid-column: span 1;
    }

    .sidebar-item {
        font-size: 13px;
        padding: 10px 16px;
    }
}

@media (max-width: 768px) {
    .main-app.active {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        bottom: auto;
        width: 100%;
        height: auto;
        padding: 8px 10px;
        z-index: 35;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
        backdrop-filter: blur(8px);
    }

    .sidebar-header-row,
    .sidebar-header,
    .sidebar-toggle-btn {
        display: none;
    }

    .sidebar-menu {
        display: flex;
        gap: 8px;
        padding: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
        align-items: center;
    }

    .sidebar-menu::-webkit-scrollbar {
        display: none;
    }

    .sidebar-item {
        padding: 8px 12px;
        border-radius: 999px;
        white-space: nowrap;
        font-size: 13px;
        scroll-snap-align: start;
        border: 1px solid rgba(255, 255, 255, 0.18);
        flex: 0 0 auto;
        border-right: none;
    }

    .sidebar-divider {
        display: none;
    }

    .sidebar-footer {
        display: none;
    }

    .main-content {
        margin-right: 0 !important;
        padding: 74px 12px 12px;
    }

    .top-bar {
        padding: 14px 14px;
        margin-bottom: 12px;
    }

    .content-card {
        padding: 14px;
        border-radius: 10px;
        margin-bottom: 12px;
    }

    #newRequestSection .content-card {
        padding: 16px 14px !important;
    }
    #newRequestSection .top-bar,
    #newRequestSection #requestEditBanner,
    #newRequestSection #requestForm {
        width: 100%;
    }


    .request-form-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .request-field--title,
    .request-field--institution,
    .request-field--category,
    .request-field--urgency,
    .request-field--quantity {
        grid-column: span 1;
    }

    .request-field--title {
        order: 1;
    }

    .request-field--institution {
        order: 2;
    }

    .request-field--category {
        order: 3;
    }

    .request-field--urgency {
        order: 4;
    }

    .request-field--quantity {
        order: 5;
    }

    .notifications-bell {
        width: 44px;
        height: 44px;
        top: auto;
        left: 14px;
        right: auto;
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
        z-index: 60;
    }

    .notifications-panel {
        width: min(92vw, 380px);
    }

    body.impersonating .notifications-bell {
        top: auto;
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }

    .request-submit-bar {
        position: static;
        margin: 8px 0 0 !important;
        padding: 16px 0 0 !important;
        border-top: 1px solid #e2e8f0 !important;
        background: transparent;
    }

    .request-submit-bar .btn {
        width: min(100%, 320px);
        min-width: 220px;
        max-width: 320px;
        min-height: 48px;
        font-size: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .drawer {
        width: 100%;
    }
}

