/* Dashboard Styles */
.dashboard-section {
    padding: 0rem 0;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

.dashboard-sidebar {
    background-color: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 14px;
    padding: 1rem;
    display: grid;
    gap: 0.5rem;
    position: sticky;
    top: 6rem;
}

.dashboard-nav-link {
    background: transparent;
    border: 1px solid transparent;
    color: #cbd5e1;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    text-align: left;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.dashboard-nav-link i {
    color: #94a3b8;
}

.dashboard-nav-link.active {
    background-color: #351224;
    border-color: #e31d38;
    color: #ffffff;
}

.dashboard-nav-link.active i {
    color: #e31d38;
}

.dashboard-panel {
    display: block;
}

.dashboard-card {
    background-color: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.dashboard-card h3 {
    margin: 0 0 1rem 0;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.status-message {
    margin: 0.75rem 0 0 0;
    font-size: 0.9rem;
    color: #34d399;
}

.payments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.payments-header h2 {
    margin: 0 0 0.35rem 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.payments-header p {
    margin: 0;
    color: #94a3b8;
    font-size: 0.9rem;
}

.dashboard-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
}

.dashboard-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 1rem;
}

.dashboard-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.dashboard-logout-btn {
    background-color: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.dashboard-logout-btn:hover {
    background-color: #334155;
    border-color: #475569;
    color: #ffffff;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1e293b;
    color: #94a3b8;
    font-size: 1.5rem;
}

.stat-icon.active {
    background-color: rgba(227, 29, 56, 0.2);
    color: #e31d38;
}

.stat-icon.inactive {
    background-color: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.stat-icon.new {
    background-color: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.stat-label {
    font-size: 0.875rem;
    color: #94a3b8;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dashboard-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.dashboard-search {
    flex: 1;
    min-width: 250px;
    position: relative;
    display: flex;
    align-items: center;
}

.dashboard-search i {
    position: absolute;
    left: 1rem;
    color: #94a3b8;
    font-size: 1rem;
}

.dashboard-search-input {
    width: 100%;
    background-color: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

.dashboard-search-input:focus {
    border-color: #e31d38;
}

.dashboard-add-btn {
    background-color: #e31d38;
    border: none;
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.dashboard-add-btn:hover {
    background-color: #c91e2f;
}

.dashboard-table-container {
    background-color: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 12px;
    overflow-x: auto;
}

.subscriber-card-header {
    display: grid;
    grid-template-columns: 1.2fr 2fr 1fr 1fr 0.9fr;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background-color: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.subscriber-card-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.payment-card-header {
    display: grid;
    grid-template-columns: 1.1fr 1.5fr 1fr 0.9fr 1.4fr 0.9fr;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background-color: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.payment-card-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.affiliate-admin-header {
    display: grid;
    grid-template-columns: 1.2fr 1.8fr 1fr 0.9fr 0.9fr 0.6fr 0.6fr;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background-color: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.affiliate-admin-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.affiliate-admin-card {
    display: grid;
    grid-template-columns: 1.2fr 1.8fr 1fr 0.9fr 0.9fr 0.6fr 0.6fr;
    gap: 1rem;
    align-items: center;
    background-color: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.affiliate-admin-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.affiliate-admin-cell {
    color: var(--text-primary);
    font-size: 0.875rem;
    word-break: break-word;
}

.affiliate-admin-type {
    text-transform: capitalize;
    font-weight: 600;
}

.affiliate-admin-toggle {
    display: flex;
    justify-content: flex-start;
}

.payment-card {
    display: grid;
    grid-template-columns: 1.1fr 1.5fr 1fr 0.9fr 1.4fr 0.9fr;
    gap: 1rem;
    align-items: center;
    background-color: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.payment-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.payment-card-cell {
    color: var(--text-primary);
    font-size: 0.875rem;
    word-break: break-word;
}

.payment-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.payment-status.success {
    background-color: rgba(52, 211, 153, 0.18);
    color: #34d399;
}

.payment-status.failed {
    background-color: rgba(227, 29, 56, 0.2);
    color: #e31d38;
}

.payment-status.pending {
    background-color: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}


.subscriber-card {
    display: grid;
    grid-template-columns: 1.2fr 2fr 1fr 1fr 0.9fr;
    gap: 1rem;
    align-items: center;
    background-color: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.subscriber-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.subscriber-card-cell {
    color: var(--text-primary);
    font-size: 0.875rem;
}

.subscriber-card-label {
    display: none;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #94a3b8;
}

.subscriber-card-value {
    color: var(--text-primary);
    font-size: 0.875rem;
}

.subscriber-card-email {
    word-break: break-word;
}

.subscriber-card-actions {
    display: flex;
    gap: 0.5rem;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
}

.dashboard-table thead {
    background-color: #1e293b;
}

.dashboard-table th {
    padding: 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #334155;
}

.dashboard-table td {
    padding: 1rem;
    border-bottom: 1px solid #1e293b;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.dashboard-table tbody tr:hover {
    background-color: #1a2332;
}

.dashboard-table tbody tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.status-active {
    background-color: rgba(227, 29, 56, 0.2);
    color: #e31d38;
}

.status-badge.status-inactive {
    background-color: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.dashboard-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background-color: transparent;
    border: 1px solid #334155;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.action-btn:hover {
    border-color: #475569;
    color: #ffffff;
}

.action-btn.edit-btn:hover {
    background-color: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: #3b82f6;
}

.action-btn.delete-btn:hover {
    background-color: rgba(227, 29, 56, 0.2);
    border-color: #e31d38;
    color: #e31d38;
}

.dashboard-empty-state {
    text-align: center;
    padding: 3rem;
    color: #94a3b8;
}

.dashboard-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.dashboard-empty-state p {
    margin: 0;
    font-size: 1rem;
}

/* Dashboard Login */
.dashboard-login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 2rem;
}

.dashboard-login-card {
    background-color: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 450px;
    width: 100%;
}

.dashboard-login-card h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    text-align: center;
}

.dashboard-login-card > p {
    color: #94a3b8;
    text-align: center;
    margin: 0 0 2rem 0;
}

.dashboard-login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dashboard-demo-note {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: #64748b;
    text-align: center;
    font-style: italic;
}

/* Subscriber Modal */
.subscriber-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: 110000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

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

.subscriber-modal {
    background-color: #0a1020;
    border: 1px solid #1e293b;
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    z-index: 110001;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.subscriber-modal-overlay.active .subscriber-modal {
    transform: scale(1);
}

.subscriber-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: #1e293b;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.2s;
}

.subscriber-modal-close:hover {
    background-color: #334155;
    color: #ffffff;
}

.subscriber-modal-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1.5rem 0;
}

.subscriber-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.subscriber-form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.subscriber-cancel-btn {
    flex: 1;
    background-color: transparent;
    border: 1px solid #334155;
    color: #94a3b8;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.subscriber-cancel-btn:hover {
    border-color: #475569;
    color: #ffffff;
}

.subscriber-save-btn {
    flex: 1;
    background-color: #e31d38;
    border: none;
    color: #ffffff;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.subscriber-save-btn:hover {
    background-color: #c91e2f;
}

/* Mobile Responsive */
@media (max-width: 771px) {
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
        min-width: 0;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    .stat-label {
        font-size: 0.75rem;
        line-height: 1.2;
        letter-spacing: 0.4px;
    }

    .dashboard-controls {
        flex-direction: column;
    }

    .dashboard-search {
        width: 100%;
    }

    .dashboard-add-btn {
        width: 100%;
        justify-content: center;
    }

    .dashboard-table-container {
        overflow-x: auto;
    }

    .dashboard-table {
        min-width: 600px;
    }

    .dashboard-title-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-logout-btn {
        width: 100%;
        justify-content: center;
    }

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

    .dashboard-sidebar {
        position: static;
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        align-items: center;
        justify-items: stretch;
    }

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

    .dashboard-sidebar {
        position: static;
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        align-items: center;
        justify-items: stretch;
    }

    .subscriber-card-header,
    .subscriber-card {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .subscriber-card-header {
        display: none;
    }

    .subscriber-card {
        align-items: flex-start;
        padding: 1rem;
        border-radius: 8px;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "name email"
            "joined status"
            "actions actions";
        grid-auto-rows: minmax(0, auto);
    }

    .subscriber-card-actions {
        width: 100%;
        grid-column: 1 / -1;
        grid-area: actions;
    }

    .subscriber-card-cell {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        min-width: 0;
    }

    .subscriber-card-label {
        display: block;
    }

    .subscriber-card-value {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .subscriber-card-email {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .payment-card-header {
        display: none;
    }

    .payment-card {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
        align-items: flex-start;
    }

    .payment-card-cell {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
    }

    .payment-card-cell::before {
        content: attr(data-label);
        font-size: 0.7rem;
        color: #94a3b8;
        text-transform: uppercase;
        letter-spacing: 0.4px;
    }

    .affiliate-admin-header {
        display: none;
    }

    .affiliate-admin-card {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
        align-items: flex-start;
    }

    .affiliate-admin-cell {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
    }

    .affiliate-admin-cell::before {
        content: attr(data-label);
        font-size: 0.7rem;
        color: #94a3b8;
        text-transform: uppercase;
        letter-spacing: 0.4px;
    }

    .subscriber-card-cell:nth-child(1) {
        grid-area: name;
    }

    .subscriber-card-cell:nth-child(2) {
        grid-area: email;
    }

    .subscriber-card-cell:nth-child(3) {
        grid-area: status;
    }

    .subscriber-card-cell:nth-child(4) {
        grid-area: joined;
    }

    .subscriber-card .status-badge {
        padding: 5px;
        justify-self: start;
        width: 66px;
        text-align: center;
    }
}

@media (min-width: 772px) and (max-width: 1100px) {
    .dashboard-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .subscriber-card-header,
    .subscriber-card {
        grid-template-columns: 1.4fr 1.6fr 1fr 1fr 0.8fr;
    }
}
