/* === SUBSCRIBERS.CSS ===
   assets/css/subscribers.css
   НАЗНАЧЕНИЕ: Стили для Subscribers, Payments, Settings
   РАЗМЕР: ~150 строк */

/* -- List + Detail Layout -- */
.list-detail-layout {
    display: flex;
    height: calc(100vh - 120px);
    overflow: hidden;
}
.subscriber-list-panel {
    width: 280px;
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}
.list-toolbar {
    display: flex;
    gap: 6px;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}
.list-toolbar .zk-input {
    flex: 1;
    min-width: 80px;
}
.list-toolbar .zk-select {
    flex: 0 0 auto;
    min-width: 100px;
}
.subscriber-list {
    flex: 1;
    overflow-y: auto;
}
.subscriber-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}
.subscriber-item:hover {
    background: var(--hover-bg);
}
.subscriber-item.active {
    background: var(--color-primary-bg);
    border-left: 3px solid var(--color-primary);
}
.sub-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}
.sub-item-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sub-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.subscriber-detail {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
}
.list-pagination {
    display: flex;
    gap: 4px;
    padding: 8px 10px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}
.sub-page-btn, .pay-page-btn {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-family: var(--font-sans);
}
.sub-page-btn.active, .pay-page-btn.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* -- Detail -- */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.detail-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-content: start;
}
.detail-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px;
}
.detail-section-full {
    grid-column: 1 / -1;
}
.detail-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.detail-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color-light);
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
    flex: 0 0 auto;
    min-width: 120px;
    font-size: 12px;
    color: var(--text-muted);
}
.detail-val {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
}

/* -- Status Badges -- */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.status-badge.status-active, .status-badge.status-approved {
    background: rgba(74, 222, 128, 0.15);
    color: var(--color-success);
}
.status-badge.status-expired, .status-badge.status-declined {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
}
.status-badge.status-cancelled, .status-badge.status-refunded {
    background: rgba(161, 161, 170, 0.15);
    color: var(--text-muted);
}
.status-badge.status-never_paid, .status-badge.status-pending {
    background: rgba(251, 191, 36, 0.15);
    color: var(--color-warning);
}

/* -- Payment Table -- */
.payment-table {
    width: 100%;
    border-collapse: collapse;
}
.payment-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.payment-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color-light);
    font-size: 13px;
    color: var(--text-primary);
}
.payment-table tbody tr:hover {
    background: var(--hover-bg);
}
.pay-amount {
    font-weight: 600;
    font-family: var(--font-mono);
}
.pay-ref {
    font-size: 11px;
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}
.pay-row-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    transition: var(--transition);
}
.pay-row-toggle.rotated {
    transform: rotate(180deg);
}
.pay-row-toggle svg {
    width: 14px;
    height: 14px;
}
.pay-row-detail {
    display: none;
}
.pay-row-detail.expanded {
    display: table-row;
}
.pay-detail-content {
    padding: 10px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}
.pay-detail-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.pay-detail-json {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

/* -- Payments Header -- */
.payments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}
.payments-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}
.payments-filters {
    display: flex;
    gap: 6px;
}
.payments-table-wrap {
    overflow-x: auto;
}

/* -- Import Modal -- */
.import-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.import-modal {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    width: 400px;
    max-width: 90vw;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}
.modal-body {
    margin-bottom: 10px;
}
.modal-body p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.modal-footer {
    text-align: right;
}

/* -- Settings -- */
.settings-page h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}
.settings-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
}
.section-header {
    padding: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    user-select: none;
}
.section-arrow {
    display: inline-block;
    font-size: 10px;
    transition: var(--transition);
    margin-right: 4px;
}
.settings-section.collapsed .section-body {
    display: none;
}
.settings-section.collapsed .section-arrow {
    transform: rotate(-90deg);
}
.section-body {
    padding: 0 10px 10px 10px;
}
.settings-footer {
    padding: 10px 0;
    text-align: right;
}

/* -- Webhook URL -- */
.webhook-url-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.webhook-url {
    background: var(--bg-input);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-primary);
    word-break: break-all;
}
.copy-btn {
    flex: 0 0 auto;
    padding: 4px 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.copy-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}
.copy-btn svg {
    width: 14px;
    height: 14px;
}

/* -- Toggle Switch -- */
.toggle-wrap {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}
.toggle-wrap input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border-color);
    border-radius: 20px;
    transition: var(--transition);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    bottom: 2px;
    background: var(--text-primary);
    border-radius: 50%;
    transition: var(--transition);
}
.toggle-wrap input:checked + .toggle-slider {
    background: var(--color-success);
}
.toggle-wrap input:checked + .toggle-slider::before {
    transform: translateX(16px);
}

/* -- Plans Table -- */
.plans-table .zk-input {
    width: 100%;
    padding: 4px 6px;
    font-size: 13px;
}

/* -- Settings inputs -- */
.settings-section .zk-input {
    flex: 1;
}

/* -- Empty states -- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}
.empty-state-sm {
    text-align: center;
    padding: 10px;
    color: var(--text-muted);
    font-size: 12px;
}
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }

/* -- Responsive -- */
@media (max-width: 768px) {
    .list-detail-layout {
        flex-direction: column;
        height: auto;
    }
    .subscriber-list-panel {
        width: 100%;
        flex: none;
        max-height: 40vh;
    }
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .payments-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* -- Reduced motion -- */
@media (prefers-reduced-motion: reduce) {
    .subscriber-item,
    .pay-row-toggle,
    .copy-btn,
    .toggle-slider,
    .toggle-slider::before,
    .section-arrow {
        transition: none;
    }
}
