/* Глобальный UX: подтверждения, toast, пустые состояния, загрузка */

.confirm-overlay,
.prompt-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(4px);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    font-family: 'Inter', system-ui, sans-serif;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.confirm-overlay.active,
.prompt-overlay.active {
    display: flex;
    opacity: 1;
}

.confirm-card {
    background: var(--potok-bg-card, #fff);
    border-radius: var(--potok-radius-modal, 16px);
    border: 1px solid rgba(147, 197, 253, 0.35);
    padding: 1.35rem 1.35rem 1.15rem;
    max-width: 22rem;
    width: 100%;
    text-align: center;
    box-shadow:
        0 0 0 1px rgba(59, 130, 246, 0.05),
        var(--potok-shadow-modal, 0 24px 48px rgba(15, 23, 42, 0.14));
    transform: translateY(8px) scale(0.98);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.confirm-overlay.active .confirm-card {
    transform: translateY(0) scale(1);
}

.confirm-card__icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 0.85rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-card__icon--danger {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #dc2626;
    border: 1px solid #fecaca;
}

.confirm-card__icon--warning {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    color: #d97706;
    border: 1px solid #fde68a;
}

.confirm-card__title {
    margin: 0 0 0.55rem;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--potok-text, #1a1a1a);
    line-height: 1.35;
}

.confirm-card__highlight {
    margin: 0 0 0.55rem;
    padding: 0.45rem 0.65rem;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid var(--potok-border, #e5e7eb);
    font-size: 0.88rem;
    font-weight: 600;
    color: #374151;
    line-height: 1.4;
    word-break: break-word;
}

.confirm-card__hint {
    margin: 0 0 1.1rem;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--potok-text-secondary, #6b7280);
}

.confirm-card__hint:empty {
    display: none;
    margin: 0;
}

.confirm-card__sr-desc {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.confirm-card__actions {
    display: flex;
    gap: 0.45rem;
}

.confirm-card__btn {
    flex: 1;
    padding: 0.55rem 0.75rem;
    border-radius: var(--potok-radius-btn, 8px);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--potok-transition, all 0.2s ease);
    border: none;
}

.confirm-card__btn--ghost {
    background: #fff;
    color: #374151;
    border: 1px solid var(--potok-border, #e5e7eb);
}

.confirm-card__btn--ghost:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.confirm-card__btn--danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.28);
}

.confirm-card__btn--danger:hover {
    filter: brightness(1.05);
}

.confirm-card__btn--warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.28);
}

.confirm-card__btn--warning:hover {
    filter: brightness(1.05);
}

.prompt-dialog {
    background: var(--potok-bg-card, #fff);
    border-radius: var(--potok-radius-modal, 16px);
    border: 1px solid rgba(147, 197, 253, 0.35);
    padding: 1.5rem 1.75rem 1.25rem;
    max-width: 24rem;
    width: 100%;
    box-shadow:
        0 0 0 1px rgba(59, 130, 246, 0.06),
        0 20px 50px rgba(15, 23, 42, 0.14);
}

.prompt-title {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.02em;
}

.prompt-message {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #6b7280;
}

.prompt-label {
    display: block;
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    letter-spacing: 0.02em;
}

.prompt-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.625rem 0.875rem;
    margin-bottom: 0.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9375rem;
    color: #111827;
    background: #fff;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.prompt-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.prompt-input.is-invalid {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}

.prompt-error {
    margin: 0 0 0.75rem;
    font-size: 0.8125rem;
    color: #dc2626;
}

.prompt-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-prompt-cancel {
    padding: 0.625rem 1.125rem;
    border: 1px solid var(--potok-border, #e5e7eb);
    border-radius: var(--potok-radius-btn, 10px);
    background: #fff;
    color: #374151;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--potok-transition, all 0.2s ease);
}

.btn-prompt-cancel:hover {
    background: #f9fafb;
}

.btn-prompt-ok {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--potok-radius-btn, 10px);
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
    transition: filter 0.2s ease, box-shadow 0.2s ease;
}

.btn-prompt-ok:hover {
    filter: brightness(1.04);
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.35);
}

.potok-toast-host {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 600;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    pointer-events: none;
    max-width: min(22rem, calc(100vw - 2rem));
}

.potok-toast {
    pointer-events: auto;
    padding: 0.75rem 1rem;
    border-radius: var(--potok-radius-btn, 10px);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.4;
    color: #fff;
    background: #1f2937;
    box-shadow: var(--potok-shadow-card-hover, 0 4px 12px rgba(0, 0, 0, 0.12));
    animation: potok-fade-in-up 0.25s ease forwards;
}

.potok-toast.success {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}

.potok-toast.error {
    background: #dc2626;
}

.potok-empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--potok-text-secondary, #6b7280);
    font-size: 1rem;
    line-height: 1.55;
    background: var(--potok-bg-card, #fff);
    border: 1px dashed var(--potok-border, #e5e7eb);
    border-radius: var(--potok-radius-card, 16px);
    margin: 0.5rem 0;
}

.potok-empty-state strong {
    display: block;
    color: var(--potok-text, #1a1a1a);
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.potok-skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: potok-skeleton-shine 1.2s ease-in-out infinite;
    border-radius: var(--potok-radius-card, 16px);
}

@keyframes potok-skeleton-shine {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.board-loading.potok-loading-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 12rem;
    padding: 2rem;
    color: var(--potok-text-secondary, #6b7280);
    font-size: 1rem;
}

.board-loading .spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: potok-spin 0.7s linear infinite;
}

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

.comment-item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.comment-delete-btn {
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.comment-delete-btn:hover {
    color: #dc2626;
    background: #fef2f2;
}

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-right: 0.5rem;
    border: 1px solid var(--potok-border, #e5e7eb);
    border-radius: var(--potok-radius-btn, 10px);
    background: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.4);
    z-index: 90;
}

.sidebar-backdrop.visible {
    display: block;
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: inline-flex;
    }

    body.app-layout .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 100;
        width: min(240px, 84vw);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: none;
        border-right: 1px solid var(--potok-sidebar-border);
        flex-direction: column;
        padding: 0.85rem 0.55rem;
        background: var(--potok-sidebar-bg);
    }

    body.app-layout.sidebar-open .app-sidebar {
        transform: translateX(0);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    }

    body.app-layout.sidebar-open .sidebar-backdrop {
        display: block;
    }

    body.app-layout .sidebar-nav-main {
        padding-top: 12px;
    }

    body.app-layout .sidebar-brand {
        padding: 16px 12px;
    }

    body.app-layout .sidebar-nav {
        flex-direction: column;
        overflow-y: auto;
    }

    body.app-layout .nav-item {
        justify-content: flex-start;
        padding: 10px 12px;
        border-radius: var(--potok-radius-btn, 8px);
    }

    body.app-layout .nav-label {
        display: inline;
        margin-left: 0.75rem;
    }

    body.app-layout .nav-item.active::before {
        display: none;
    }

    body.app-layout .app-frame {
        width: 100%;
    }

    .modal.modal-task {
        width: 95vw !important;
        max-width: 95vw !important;
        height: 92vh !important;
        max-height: 92vh !important;
        border-radius: var(--potok-radius-modal, 20px) !important;
    }

    .confirm-card {
        max-width: 95vw;
    }

    .potok-toast-host {
        left: 1rem;
        right: 1rem;
        align-items: stretch;
    }
}
