/**
 * Customer Portal Styles
 *
 * @package Webtown_Subscription
 */

/* Subscription Status Badges */
.wtsub-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wtsub-status-pending {
    background: #f0f0f0;
    color: #666;
}

.wtsub-status-created {
    background: #e3f2fd;
    color: #1976d2;
}

.wtsub-status-authenticated {
    background: #e8f5e9;
    color: #388e3c;
}

.wtsub-status-active {
    background: #4caf50;
    color: #fff;
}

.wtsub-status-paused {
    background: #ff9800;
    color: #fff;
}

.wtsub-status-past_due {
    background: #ff5722;
    color: #fff;
}

.wtsub-status-halted {
    background: #f44336;
    color: #fff;
}

.wtsub-status-cancelled {
    background: #9e9e9e;
    color: #fff;
}

.wtsub-status-completed {
    background: #2196f3;
    color: #fff;
}

.wtsub-status-expired {
    background: #757575;
    color: #fff;
}

/* Payment Status */
.wtsub-payment-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 600;
}

.wtsub-payment-captured {
    background: #4caf50;
    color: #fff;
}

.wtsub-payment-failed {
    background: #f44336;
    color: #fff;
}

.wtsub-payment-pending {
    background: #ff9800;
    color: #fff;
}

.wtsub-payment-authorized {
    background: #2196f3;
    color: #fff;
}

/* Subscription Details */
.wtsub-subscription-details {
    margin: 20px 0;
}

.wtsub-subscription-info,
.wtsub-subscription-actions,
.wtsub-payment-history {
    margin: 30px 0;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.wtsub-subscription-info h3,
.wtsub-subscription-actions h3,
.wtsub-payment-history h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    color: #333;
}

.wtsub-subscription-info table {
    width: 100%;
    margin: 0;
}

.wtsub-subscription-info table th {
    width: 200px;
    text-align: left;
    padding: 10px 0;
    font-weight: 600;
    color: #666;
}

.wtsub-subscription-info table td {
    padding: 10px 0;
    color: #333;
}

/* Action Buttons */
.wtsub-subscription-actions button {
    margin-right: 10px;
    margin-bottom: 10px;
}

.wtsub-action.wtsub-cancel {
    background: #f44336;
    border-color: #f44336;
    color: #fff;
}

.wtsub-action.wtsub-cancel:hover {
    background: #d32f2f;
    border-color: #d32f2f;
}

/* Payment History Table */
.wtsub-payment-history table {
    margin-top: 15px;
}

.wtsub-payment-history code {
    background: #fff;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    color: #d32f2f;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .wtsub-subscription-info table th {
        width: auto;
        display: block;
        padding: 5px 0;
    }

    .wtsub-subscription-info table td {
        display: block;
        padding: 5px 0 15px;
    }

    .wtsub-subscription-actions button {
        display: block;
        width: 100%;
        margin-right: 0;
    }
}

/* Customer Portal */
.wtsub-customer-portal {
    margin: 20px 0;
}

.wtsub-customer-portal h2 {
    margin-bottom: 20px;
}

/* Empty State */
.wtsub-customer-portal p {
    margin-bottom: 20px;
}

/* Loading State */
.wtsub-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Modal Styles */
.wtsub-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.wtsub-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    cursor: pointer;
}

.wtsub-modal-content {
    position: relative;
    max-width: 600px;
    margin: 50px auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1000000;
    animation: wtsub-modal-slide-down 0.3s ease-out;
}

@keyframes wtsub-modal-slide-down {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wtsub-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
}

.wtsub-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.wtsub-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.wtsub-modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.wtsub-modal-body {
    padding: 25px;
}

.wtsub-modal-body > p:first-child {
    margin-top: 0;
    font-size: 15px;
    color: #666;
    margin-bottom: 20px;
}

.wtsub-cancel-options {
    margin: 20px 0;
}

.wtsub-cancel-option {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    margin-bottom: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wtsub-cancel-option:hover {
    border-color: #2563eb;
    background: #f8faff;
}

.wtsub-cancel-option:has(input:checked) {
    border-color: #2563eb;
    background: #f0f7ff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

.wtsub-cancel-option input[type="radio"] {
    margin-top: 3px;
    margin-right: 12px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.wtsub-option-content {
    flex: 1;
}

.wtsub-option-content strong {
    display: block;
    font-size: 15px;
    color: #333;
    margin-bottom: 6px;
}

.wtsub-option-content .description {
    margin: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.wtsub-cancel-reason {
    margin-top: 20px;
}

.wtsub-cancel-reason label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
}

.wtsub-cancel-reason textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.wtsub-cancel-reason textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.wtsub-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 25px;
    border-top: 1px solid #e0e0e0;
    background: #f9f9f9;
    border-radius: 0 0 8px 8px;
}

.wtsub-modal-footer .button {
    margin: 0;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.wtsub-modal-cancel-btn {
    background: #fff;
    border: 1px solid #ddd;
    color: #666;
}

.wtsub-modal-cancel-btn:hover {
    background: #f5f5f5;
    border-color: #999;
    color: #333;
}

.wtsub-confirm-cancel {
    background: #f44336;
    border-color: #f44336;
    color: #fff;
}

.wtsub-confirm-cancel:hover {
    background: #d32f2f;
    border-color: #d32f2f;
}

.wtsub-confirm-cancel:disabled {
    background: #ffcdd2;
    border-color: #ffcdd2;
    cursor: not-allowed;
}

/* Prevent body scroll when modal is open */
body.wtsub-modal-open {
    overflow: hidden;
}

/* Cancel Subscription Modal */
.wtsub-modal-header--danger {
    border-bottom-color: #fee2e2;
    background: #fef2f2;
    border-radius: 8px 8px 0 0;
}

.wtsub-modal-header--danger h3 {
    color: #dc2626;
}

.wtsub-modal-header-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fee2e2;
    border-radius: 50%;
    color: #dc2626;
    margin-right: 12px;
    flex-shrink: 0;
}

.wtsub-cancel-warning {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    padding: 16px 16px 16px 20px;
    margin: 16px 0;
}

.wtsub-cancel-warning ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.wtsub-cancel-warning ul li {
    position: relative;
    padding: 4px 0 4px 20px;
    font-size: 14px;
    color: #92400e;
    line-height: 1.5;
}

.wtsub-cancel-warning ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 11px;
    width: 8px;
    height: 8px;
    background: #f59e0b;
    border-radius: 50%;
}

.wtsub-cancel-warning-note {
    font-size: 13px;
    font-weight: 600;
    color: #dc2626;
    margin: 0;
}

.wtsub-confirm-cancel-sub {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
    color: #fff !important;
    transition: background 0.2s ease;
}

.wtsub-confirm-cancel-sub:hover {
    background: #b91c1c !important;
    border-color: #b91c1c !important;
}

.wtsub-confirm-cancel-sub:disabled {
    background: #fca5a5 !important;
    border-color: #fca5a5 !important;
    cursor: not-allowed;
}

/* Responsive Modal */
@media screen and (max-width: 768px) {
    .wtsub-modal-content {
        margin: 20px;
        max-width: calc(100% - 40px);
    }

    .wtsub-modal-header,
    .wtsub-modal-body,
    .wtsub-modal-footer {
        padding: 15px 20px;
    }

    .wtsub-cancel-option {
        padding: 12px;
    }

    .wtsub-modal-footer {
        flex-direction: column-reverse;
    }

    .wtsub-modal-footer .button {
        width: 100%;
        margin: 0;
    }
}
