/* =============================================================
   Huntarr — Notifications Page
   Modern multi-provider notification management
   ============================================================= */

/* ---- Container — align with content boundary (no horizontal padding) ---- */
.notif-container {
    width: 100%;
    padding: 0;
    box-sizing: border-box;
}

/* ---- Cards ---- */
.notif-card {
    background: rgba(30, 32, 44, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.notif-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.notif-card-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notif-card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
}

.notif-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    flex-shrink: 0;
}

.notif-icon-blue    { background: linear-gradient(135deg, #6366f1, #818cf8); }
.notif-icon-green   { background: linear-gradient(135deg, #059669, #34d399); }
.notif-icon-slate   { background: linear-gradient(135deg, #475569, #64748b); }
.notif-icon-amber   { background: linear-gradient(135deg, #d97706, #fbbf24); }
.notif-icon-red     { background: linear-gradient(135deg, #dc2626, #f87171); }

.notif-card-body {
    padding: 20px;
}

/* ---- Provider Grid (fill page width, auto-fit columns) ---- */
.notif-provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.notif-provider-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.notif-provider-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(129, 140, 248, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.notif-provider-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
}

.notif-provider-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
}

.notif-provider-card-desc {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    line-height: 1.3;
    display: none; /* hidden to keep cards compact */
}

/* ---- Connection Groups (organized by app type) ---- */
.notif-group {
    margin-bottom: 16px;
}

.notif-group:last-child {
    margin-bottom: 0;
}

.notif-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px 10px 0 0;
    border-bottom: none;
}

.notif-group-header-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    flex-shrink: 0;
}

.notif-group-header-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
}

.notif-group-header-count {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    margin-left: auto;
}

.notif-group-body {
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0 0 10px 10px;
    overflow: hidden;
}

/* ---- Connection List ---- */
.notif-connection-list {
    display: flex;
    flex-direction: column;
}

.notif-connection-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.015);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: all 0.15s ease;
}

.notif-connection-item:last-child {
    border-bottom: none;
}

.notif-connection-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notif-connection-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.notif-connection-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.notif-connection-info {
    min-width: 0;
    flex: 1;
}

.notif-connection-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-connection-meta {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.notif-connection-provider-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 7px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 10px;
}

.notif-connection-scope-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 7px;
    border-radius: 20px;
    background: rgba(129, 140, 248, 0.12);
    color: #a5b4fc;
    font-size: 10px;
}

.notif-connection-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
}

.notif-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.notif-status-dot.active { background: #34d399; }
.notif-status-dot.disabled { background: #64748b; }

.notif-connection-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.notif-btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s ease;
}

.notif-btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #e2e8f0);
}

.notif-btn-icon.test-btn:hover { color: #34d399; border-color: rgba(52, 211, 153, 0.3); background: rgba(52, 211, 153, 0.08); }
.notif-btn-icon.edit-btn:hover { color: #fbbf24; border-color: rgba(251, 191, 36, 0.3); }
.notif-btn-icon.delete-btn:hover { color: #f87171; border-color: rgba(248, 113, 113, 0.3); }

/* ---- Empty State ---- */
.notif-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted, #94a3b8);
}

.notif-empty-state i {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.notif-empty-state p {
    font-size: 14px;
    margin: 0;
}

/* ---- Modal ---- */
.notif-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.notif-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.notif-modal {
    background: #1e2030;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.2s ease;
}

.notif-modal-overlay.active .notif-modal {
    transform: translateY(0) scale(1);
}

.notif-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.notif-modal-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notif-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
}

.notif-modal-close {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.15s ease;
}

.notif-modal-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.notif-modal-body {
    padding: 20px;
}

/* ---- Form Fields ---- */
.notif-form-group {
    margin-bottom: 14px;
}

.notif-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary, #e2e8f0);
    margin-bottom: 5px;
}

.notif-form-group label .required {
    color: #f87171;
    margin-left: 2px;
}

/* Visual properties enforced by components.css — only layout kept here */
.notif-form-group input[type="text"],
.notif-form-group input[type="password"],
.notif-form-group input[type="number"],
.notif-form-group select,
.notif-form-group textarea {
    width: 100%;
    padding: 9px 11px;
    font-size: 13px;
}

.notif-form-group textarea {
    min-height: 70px;
    resize: vertical;
    font-family: inherit;
}

.notif-form-help {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    margin-top: 3px;
    line-height: 1.4;
}

/* Checkbox field */
.notif-checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-checkbox-row input[type="checkbox"] {
    width: auto;
    accent-color: #818cf8;
}

/* ---- Scope Row (App + Instance dropdowns) ---- */
.notif-scope-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

/* ---- Triggers Section ---- */
.notif-triggers-section {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.notif-triggers-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
    margin-bottom: 10px;
}

.notif-triggers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.notif-trigger-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.notif-trigger-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notif-trigger-item input[type="checkbox"] {
    accent-color: #818cf8;
    flex-shrink: 0;
}

.notif-trigger-label {
    font-size: 12px;
    color: var(--text-primary, #e2e8f0);
    user-select: none;
}

/* ---- Options Row ---- */
.notif-options-row {
    display: flex;
    gap: 16px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.notif-options-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-primary, #e2e8f0);
    cursor: pointer;
}

.notif-options-row input[type="checkbox"] {
    accent-color: #818cf8;
}

/* ---- Modal Footer ---- */
.notif-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.notif-modal-footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-modal-footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-btn {
    padding: 8px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.notif-btn-cancel {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted, #94a3b8);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.notif-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #e2e8f0);
}

.notif-btn-test {
    background: rgba(52, 211, 153, 0.1);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.notif-btn-test:hover {
    background: rgba(52, 211, 153, 0.18);
}

.notif-btn-test:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.notif-btn-save {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
}

.notif-btn-save:hover {
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.notif-btn-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* ---- Connection Name Input ---- */
.notif-name-group {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* ---- Spinning test indicator ---- */
.notif-btn-icon.testing {
    color: #818cf8;
}

.notif-btn-icon.testing i,
.notif-btn.notif-btn-test.testing i {
    animation: notif-spin 0.8s linear infinite;
}

@keyframes notif-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .notif-provider-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .notif-triggers-grid {
        grid-template-columns: 1fr;
    }

    .notif-connection-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .notif-connection-actions {
        align-self: flex-end;
    }

    .notif-modal {
        max-width: 100%;
        margin: 10px;
    }

    .notif-options-row {
        flex-direction: column;
        gap: 10px;
    }

    .notif-scope-row {
        grid-template-columns: 1fr;
    }

    .notif-modal-footer {
        flex-direction: column;
        gap: 10px;
    }

    .notif-modal-footer-left,
    .notif-modal-footer-right {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    .notif-provider-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .notif-provider-card {
        padding: 10px 8px;
    }
}
