/**
 * Mandate Management - My Account Page
 * Uses theme primary color (--primary_color) or VetplusNL huisstijl (#2daee0)
 *
 * @package MollieSEPADirectDebit
 */

:root {
    --msdd-primary: var(--primary_color, var(--vetplusnl-primary-color, #2daee0));
    --msdd-primary-hover: color-mix(in srgb, var(--msdd-primary) 80%, black);
}

.msdd-mandate-management {
    margin: 0 0 2rem;
    max-width: 40rem;
    font-size: 1rem; /* base size – distinction via font-weight */
}

.msdd-page-title {
    margin: 0 0 1.25rem;
    font-weight: 600;
}

/* Mandate card */
.msdd-mandate-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    padding: 1.125rem 1.375rem;
    margin-bottom: 1.25rem;
}

.msdd-mandate-card__header {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    margin-bottom: 1rem;
}

.msdd-mandate-card__icon {
    flex-shrink: 0;
    width: 1.375rem;
    height: 1.375rem;
    background: var(--msdd-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    line-height: 1;
}

.msdd-mandate-card__title {
    margin: 0 0 0.15rem;
    font-weight: 600;
    color: #1e1e1e;
    font-size: 1em;
}

.msdd-mandate-card__subtitle {
    margin: 0;
    font-weight: 400;
    color: #50575e;
}

/* Mandate details */
.msdd-mandate-details {
    display: grid;
    gap: 0.4rem 1.25rem;
    margin: 0 0 1rem;
    padding-top: 0.875rem;
    border-top: 1px solid #eee;
}

.msdd-mandate-details__row {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 0.5rem;
    align-items: baseline;
}

.msdd-mandate-details dt {
    margin: 0;
    font-weight: 600;
    color: #646970;
}

.msdd-mandate-details dd {
    margin: 0;
    font-weight: 400;
}

.msdd-mono {
    font-family: ui-monospace, monospace;
}

/* Status badge */
.msdd-status-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-weight: 600;
}

.msdd-status-badge.msdd-status-active {
    background: #e8f4ec;
    color: #0e8345;
}

.msdd-status-badge.msdd-status-blocked {
    background: #fdecea;
    color: #b32d2e;
}

.msdd-status-badge.msdd-status-cancelled {
    background: #f0f0f0;
    color: #646970;
}

/* Mandate actions */
.msdd-mandate-actions {
    padding-top: 0.875rem;
    border-top: 1px solid #eee;
}

.msdd-mandate-actions__hint {
    margin: 0.5rem 0 0;
    font-weight: 400;
    color: #646970;
    max-width: 28rem;
}

.msdd-cancel-mandate-btn {
    background: var(--msdd-primary) !important;
    border-color: var(--msdd-primary) !important;
    color: #fff !important;
    padding: 0.5rem 1rem;
    font-weight: 600;
}

.msdd-cancel-mandate-btn:hover {
    background: var(--msdd-primary-hover) !important;
    border-color: var(--msdd-primary-hover) !important;
    color: #fff !important;
}

.msdd-cancel-mandate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Empty mandate state */
.msdd-mandate-card--empty {
    padding: 1.25rem 1.375rem;
}

.msdd-mandate-card--empty .msdd-alert {
    margin-bottom: 0.875rem;
}

.msdd-heading-sm {
    margin: 0 0 0.4rem;
    font-weight: 600;
}

.msdd-list {
    margin: 0 0 0.875rem 1.125rem;
    padding: 0;
    list-style: disc;
}

.msdd-list li {
    margin-bottom: 0.2rem;
}

/* Alerts */
.msdd-alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 0.875rem;
}

.msdd-alert--error {
    background: #fcf0f1;
    border-left: 3px solid #b32d2e;
    color: #1e1e1e;
}

.msdd-alert--info {
    background: #f5f9fc;
    border-left: 3px solid var(--msdd-primary);
    color: #1e1e1e;
}

.msdd-alert p {
    margin: 0 0 0.25rem;
}

.msdd-alert p:last-child {
    margin-bottom: 0;
}

.msdd-muted {
    color: #646970;
    font-weight: 400;
}

.msdd-action-prompt {
    margin: 0.4rem 0 0;
}

/* Chargeback warning */
.msdd-chargeback-warning {
    margin-top: 0.875rem;
}

.msdd-chargeback-warning .msdd-alert {
    margin-bottom: 0;
}

/* Info section */
.msdd-info-section {
    margin-top: 1.5rem;
    padding: 0.875rem 1.125rem;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid var(--msdd-primary);
}

.msdd-info-section__title {
    margin: 0 0 0.4rem;
    font-weight: 600;
    color: #1e1e1e;
    font-size: 1.125rem;
}

.msdd-info-section p {
    margin: 0 0 0.4rem;
    font-weight: 400;
}

.msdd-list--compact {
    margin-bottom: 0;
}

.msdd-cancel-result {
    margin-top: 0.875rem;
}

#msdd-cancel-result .woocommerce-message,
#msdd-cancel-result .woocommerce-error {
    padding: 0.875rem 1rem;
    border-radius: 6px;
}

/* Modal styles */
.msdd-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

.msdd-modal-overlay.active {
    display: flex;
}

.msdd-modal {
    background: #fff;
    max-width: 500px;
    width: 90%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    font-size: 0.9375rem;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.msdd-modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.msdd-modal-header h3 {
    margin: 0;
    font-weight: 600;
}

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

.msdd-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.msdd-modal-footer .button {
    margin: 0;
}

/* Success/Error messages */
#msdd-cancel-result .woocommerce-message,
#msdd-cancel-result .woocommerce-error {
    padding: 15px;
    margin-top: 15px;
    border-radius: 4px;
}

/* Loading state */
.msdd-loading {
    opacity: 0.6;
    pointer-events: none;
}

.msdd-loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .msdd-modal {
        width: 95%;
        max-width: none;
    }
    
    .msdd-modal-footer {
        flex-direction: column;
    }
    
    .msdd-modal-footer .button {
        width: 100%;
        text-align: center;
    }
}

