/* ═══════════════════════════════════════════════════
   NEWSLETTER ADMIN PANEL — CSS  (Stage 5)
   Prefix: nla-
   ═══════════════════════════════════════════════════ */

/* ── Section wrapper ── */
.nla-section {
    padding: 24px 32px 60px;
    max-width: 1320px;
    margin: 0 auto;
}

/* ── Header ── */
.nla-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
}
.nla-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #e0e0e0;
    margin: 0;
}
.nla-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── Stats grid ── */
.nla-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}
.nla-stat-card {
    background: rgba(15, 42, 42, 0.5);
    border: 1px solid rgba(127, 255, 0, 0.1);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color 0.2s;
}
.nla-stat-card:hover {
    border-color: rgba(127, 255, 0, 0.3);
}
.nla-stat-icon {
    font-size: 28px;
    flex-shrink: 0;
}
.nla-stat-value {
    font-size: 26px;
    font-weight: 800;
    color: #7FFF00;
    line-height: 1;
}
.nla-stat-label {
    font-size: 12px;
    color: #8ca0a0;
    margin-top: 2px;
}

/* ── Tabs ── */
.nla-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid rgba(127, 255, 0, 0.1);
    margin-bottom: 24px;
    overflow-x: auto;
}
.nla-tab {
    background: transparent;
    border: none;
    padding: 12px 20px;
    color: #8ca0a0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.nla-tab:hover {
    color: #e0e0e0;
}
.nla-tab.active {
    color: #7FFF00;
    border-bottom-color: #7FFF00;
}

/* ── Panels ── */
.nla-panel {
    display: none;
}
.nla-panel.active {
    display: block;
}

/* ── Buttons ── */
.nla-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, background 0.2s;
    border: none;
}
.nla-btn:disabled {
    opacity: 0.5;
    cursor: default;
}
.nla-btn-primary {
    background: linear-gradient(135deg, #7FFF00, #66cc00);
    color: #0a1414;
}
.nla-btn-primary:hover:not(:disabled) {
    opacity: 0.9;
}
.nla-btn-secondary {
    background: transparent;
    color: #8ca0a0;
    border: 1px solid rgba(127, 255, 0, 0.2);
}
.nla-btn-secondary:hover:not(:disabled) {
    border-color: #7FFF00;
    color: #7FFF00;
}
.nla-btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.nla-btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.25);
}
.nla-btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

/* ── Filter bar ── */
.nla-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 18px;
}
.nla-search {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px 10px 36px;
    background: rgba(15, 42, 42, 0.6);
    border: 1px solid rgba(127, 255, 0, 0.12);
    border-radius: 10px;
    color: #e0e0e0;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238ca0a0' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7' stroke='%238ca0a0' stroke-width='2' fill='none'/%3E%3Cline x1='16.5' y1='16.5' x2='21' y2='21' stroke='%238ca0a0' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}
.nla-search:focus {
    border-color: rgba(127, 255, 0, 0.4);
}
.nla-search::placeholder {
    color: #6b8585;
}
.nla-filter-select {
    padding: 10px 14px;
    background: rgba(15, 42, 42, 0.6);
    border: 1px solid rgba(127, 255, 0, 0.12);
    border-radius: 10px;
    color: #e0e0e0;
    font-size: 13px;
    outline: none;
    cursor: pointer;
}
.nla-filter-select:focus {
    border-color: rgba(127, 255, 0, 0.4);
}

/* ── Data table ── */
.nla-table-wrap {
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid rgba(127, 255, 0, 0.08);
}
.nla-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.nla-table th {
    background: rgba(15, 42, 42, 0.6);
    color: #8ca0a0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
    padding: 12px 14px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid rgba(127, 255, 0, 0.1);
    cursor: pointer;
    user-select: none;
}
.nla-table th:hover {
    color: #7FFF00;
}
.nla-table th .sort-arrow {
    margin-left: 4px;
    opacity: 0.4;
}
.nla-table th.sorted .sort-arrow {
    opacity: 1;
    color: #7FFF00;
}
.nla-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(127, 255, 0, 0.04);
    color: #e0e0e0;
    vertical-align: middle;
}
.nla-table tbody tr:hover {
    background: rgba(127, 255, 0, 0.03);
}
.nla-table .email-cell {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nla-role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.nla-role-badge.admin { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.nla-role-badge.organizer { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.nla-role-badge.speaker { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.nla-role-badge.attendee { background: rgba(127, 255, 0, 0.1); color: #7FFF00; }

/* Channel dots (compact) */
.nla-ch-dots {
    display: flex;
    gap: 3px;
}
.nla-ch-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(127, 255, 0, 0.2);
}
.nla-ch-dot.on {
    background: #7FFF00;
}

/* ── Pagination ── */
.nla-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    gap: 12px;
}
.nla-page-info {
    font-size: 13px;
    color: #8ca0a0;
}
.nla-page-btns {
    display: flex;
    gap: 6px;
}
.nla-page-btn {
    padding: 6px 14px;
    border: 1px solid rgba(127, 255, 0, 0.15);
    border-radius: 8px;
    background: transparent;
    color: #8ca0a0;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.nla-page-btn:hover:not(:disabled) {
    border-color: #7FFF00;
    color: #7FFF00;
}
.nla-page-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

/* ── Channel breakdown bar ── */
.nla-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.nla-breakdown-item {
    display: flex;
    align-items: center;
    gap: 14px;
}
.nla-breakdown-label {
    width: 180px;
    font-size: 13px;
    font-weight: 600;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}
.nla-bar-track {
    flex: 1;
    height: 22px;
    background: rgba(15, 42, 42, 0.6);
    border-radius: 11px;
    overflow: hidden;
    position: relative;
}
.nla-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #7FFF00, #66cc00);
    border-radius: 11px;
    transition: width 0.6s ease;
    min-width: 2px;
}
.nla-breakdown-count {
    width: 60px;
    text-align: right;
    font-size: 13px;
    font-weight: 700;
    color: #7FFF00;
    flex-shrink: 0;
}

/* ── Scheduler panel ── */
.nla-scheduler-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 24px;
}
.nla-scheduler-card {
    background: rgba(15, 42, 42, 0.5);
    border: 1px solid rgba(127, 255, 0, 0.1);
    border-radius: 14px;
    padding: 20px;
}
.nla-scheduler-card h4 {
    font-size: 15px;
    font-weight: 600;
    color: #e0e0e0;
    margin: 0 0 12px;
}
.nla-sched-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}
.nla-sched-status.running {
    background: rgba(127, 255, 0, 0.12);
    color: #7FFF00;
}
.nla-sched-status.paused {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}
.nla-sched-detail {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(127, 255, 0, 0.04);
}
.nla-sched-detail:last-child {
    border-bottom: none;
}
.nla-sched-detail .label {
    color: #8ca0a0;
}
.nla-sched-detail .value {
    color: #e0e0e0;
    font-weight: 600;
}
.nla-trigger-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

/* ── Run history table ── */
.nla-run-row {
    display: grid;
    grid-template-columns: 160px 150px 100px 80px 80px 80px 1fr;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(127, 255, 0, 0.04);
    font-size: 12px;
    align-items: center;
}
.nla-run-row.header {
    background: rgba(15, 42, 42, 0.6);
    color: #8ca0a0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
    border-radius: 10px 10px 0 0;
}
.nla-run-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.nla-run-status.completed { background: rgba(127, 255, 0, 0.12); color: #7FFF00; }
.nla-run-status.failed { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.nla-run-status.running { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }

/* ── Templates panel ── */
.nla-templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.nla-template-card {
    background: rgba(15, 42, 42, 0.5);
    border: 1px solid rgba(127, 255, 0, 0.1);
    border-radius: 14px;
    padding: 20px;
    transition: border-color 0.2s;
}
.nla-template-card:hover {
    border-color: rgba(127, 255, 0, 0.25);
}
.nla-template-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 10px;
}
.nla-template-name {
    font-size: 15px;
    font-weight: 700;
    color: #e0e0e0;
}
.nla-template-active {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.nla-template-active.on { background: rgba(127, 255, 0, 0.12); color: #7FFF00; }
.nla-template-active.off { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.nla-template-meta {
    font-size: 12px;
    color: #8ca0a0;
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}
.nla-template-subject {
    font-size: 13px;
    color: #b0c4c4;
    font-style: italic;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: rgba(10, 30, 30, 0.5);
    border-radius: 8px;
    border-left: 3px solid rgba(127, 255, 0, 0.3);
}
.nla-template-actions {
    display: flex;
    gap: 8px;
}

/* ── Loading / empty ── */
.nla-loading {
    text-align: center;
    padding: 40px;
    color: #8ca0a0;
}
.nla-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(127, 255, 0, 0.2);
    border-top-color: #7FFF00;
    border-radius: 50%;
    animation: nlaSpin 0.8s linear infinite;
    margin: 0 auto 12px;
}
@keyframes nlaSpin { to { transform: rotate(360deg); } }
.nla-empty {
    text-align: center;
    padding: 60px 20px;
    color: #8ca0a0;
}
.nla-empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

/* ── Toast ── */
.nla-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    z-index: 99999;
    transition: transform 0.3s;
    pointer-events: none;
}
.nla-toast.show {
    transform: translateX(-50%) translateY(0);
}
.nla-toast.success { background: #7FFF00; color: #0a1414; }
.nla-toast.error { background: #ef4444; color: #fff; }

/* ── Modal ── */
.nla-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.nla-modal {
    background: linear-gradient(135deg, #0f2a2a, #0a1e1e);
    border: 1px solid rgba(127, 255, 0, 0.2);
    border-radius: 16px;
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 28px;
}
.nla-modal h3 {
    font-size: 18px;
    font-weight: 700;
    color: #e0e0e0;
    margin: 0 0 20px;
}
.nla-modal-field {
    margin-bottom: 16px;
}
.nla-modal-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #8ca0a0;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.nla-modal-field input,
.nla-modal-field textarea,
.nla-modal-field select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(10, 20, 20, 0.6);
    border: 1px solid rgba(127, 255, 0, 0.12);
    border-radius: 10px;
    color: #e0e0e0;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.nla-modal-field textarea {
    min-height: 140px;
    resize: vertical;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}
.nla-modal-field input:focus,
.nla-modal-field textarea:focus {
    border-color: rgba(127, 255, 0, 0.4);
}
.nla-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .nla-section { padding: 16px; }
    .nla-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .nla-scheduler-grid { grid-template-columns: 1fr; }
    .nla-tab { padding: 10px 14px; font-size: 12px; }
    .nla-run-row { grid-template-columns: 1fr 1fr; gap: 4px; font-size: 11px; }
    .nla-breakdown-label { width: 120px; font-size: 12px; }
    .nla-templates-grid { grid-template-columns: 1fr; }
    .nla-header { flex-direction: column; align-items: flex-start; }
}
