.cdm-campaigns-container {
    margin: 24px 0;
}

.cdm-frontend-notice {
    border-radius: 12px;
    margin-bottom: 20px;
    padding: 14px 16px;
}

.cdm-frontend-notice-success {
    background: #ecfdf3;
    color: #027a48;
}

.cdm-frontend-notice-failed,
.cdm-frontend-notice-cancelled {
    background: #fef3f2;
    color: #b42318;
}

.cdm-card-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(305px,1fr));
    gap:25px;
}

.cdm-card{
    background:#fff;
    border:none;
    border-radius:0;
    box-shadow:none;
    padding:0 0 25px;
    text-align:center;
}

.cdm-card-image{
    background:#f4f8fb;
    padding:35px;
    overflow:hidden;
}

.cdm-card-image img{
    width:100%;
    aspect-ratio:1/1;
    object-fit:cover;
    display:block;
}

.cdm-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
}

.cdm-card-header {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.cdm-card-header h3 {
    font-size: 1.2rem;
    margin: 0;
}

.cdm-card-badge {
    background: #eff8ff;
    border-radius: 999px;
    color: #175cd3;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 10px;
}

.cdm-card-description {
    display:none;
    color: #475467;
    margin: 0;
}

.cdm-card-metrics {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cdm-card-metrics div {
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px;
}

.cdm-card-metrics span {
    color: #667085;
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
}

.cdm-card-metrics strong {
    color: #101828;
    display: block;
    font-size: 15px;
}

.cdm-progress {
    background: #eaecf0;
    border-radius: 999px;
    height: 18px;
    overflow: hidden;
}

.cdm-progress-bar {
    align-items: center;
    animation: cdm-progress-grow 1.2s ease;
    background: linear-gradient(90deg, #0ba5ec, #7a5af8);
    color: #fff;
    display: flex;
    height: 100%;
    justify-content: flex-end;
    min-width: 44px;
    padding-right: 8px;
    transition: width 0.5s ease;
}

.cdm-progress-bar span {
    font-size: 11px;
    font-weight: 700;
}

/* Button inside campaign card header - campaign name */
.cdm-card-header .cdm-donate-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    width: auto;
    text-align: left;
    cursor: pointer;
    display: inline-block;
}

.cdm-card-header .cdm-donate-btn h3 {
    margin: 0 !important;
    color: #101828;
    font-size: 1.2rem;
    transition: color 0.2s ease;
}

.cdm-card-header .cdm-donate-btn:hover h3 {
    color: #175cd3;
}

/* Regular donate buttons */
.cdm-donate-btn,
.cdm-primary-btn,
.cdm-secondary-btn{
    margin-top:20px;
    width:100%;
    border-radius:6px;
    background:#0d6efd;
}

.cdm-donate-btn,
.cdm-primary-btn {
    background: #175cd3;
    color: #fff;
}

.cdm-secondary-btn {
    background: #f2f4f7;
    color: #344054;
}

.cdm-donate-btn:hover,
.cdm-primary-btn:hover,
.cdm-secondary-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.cdm-empty-state {
    background: #fff;
    border: 1px dashed #d0d5dd;
    border-radius: 16px;
    grid-column: 1 / -1;
    padding: 28px;
    text-align: center;
}

.cdm-front-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
    overflow-y: auto;
    /* Ensure it's perfectly centered even on scroll */
    box-sizing: border-box;
}

/* STRONG hidden state to prevent auto-opening */
div#cdm-donation-modal[hidden],
.cdm-front-modal[hidden] {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.cdm-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 1300px;
    width: 100%;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    /* Ensure modal itself stays centered */
    margin: auto;
}

.cdm-modal-left {
    flex: 1;
    min-height: 550px;
    max-height: 85vh;
    overflow: hidden;
}

.cdm-modal-left img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cdm-modal-right {
    flex: 1;
    padding: 35px 30px;
    position: relative;
    overflow-y: auto;
    max-height: 85vh;
}

.cdm-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    z-index: 10;
    transition: all 0.2s ease;
}

.cdm-modal-close:hover {
    background: rgba(0,0,0,0.2);
}

.cdm-front-modal__header h3,
#cdm-modal-title {
    margin: 0 0 6px;
    font-size: 24px;
    color: #101828;
}

#cdm-modal-description {
    color: #475467;
    margin-bottom: 20px;
}

.cdm-amount-raised {
    font-size: 16px;
    color: #101828;
    margin: 15px 0 20px;
    font-weight: 500;
}

.cdm-donate-btn-main {
    width: 100%;
    padding: 16px;
    background: #0066cc;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    margin-top: 20px;
    cursor: pointer;
}

.cdm-donate-btn-main:hover {
    background: #0055aa;
}

.cdm-donation-form {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Make Address, and buttons span full width */
.cdm-donation-form label:nth-of-type(5), /* Address */
.cdm-donation-message,
.cdm-donation-actions {
    grid-column: 1 / -1;
}

/* Amount Section Styles */
.cdm-amount-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cdm-amount-label.cdm-label {
    display: block;
    font-weight: 600;
    margin-bottom: 2px;
}

#cdm-donation-amount,
#cdm-frequency {
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    box-sizing: border-box;
    padding: 11px 12px;
    width: 100%;
    font-size: 16px;
}

#cdm-donation-amount {
    margin-top: 10px;
    margin-bottom: 14px;
}

#cdm-frequency {
    margin-bottom: 14px;
}

.cdm-preset-amounts {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cdm-preset-btn {
    border: 2px solid #e4e7ec;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    padding: 12px 8px;
    transition: all 0.2s ease;
}

.cdm-preset-btn:hover {
    border-color: #54c915;
    background: #54c915;
}

.cdm-preset-btn.is-active {
    background: #54c915;
    border-color: #54c915;
    color: #fff;
}

.cdm-donation-types {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 14px;
}

.cdm-donation-type-btn {
    border: 2px solid #e4e7ec;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    padding: 12px 8px;
    transition: all 0.2s ease;
}

.cdm-donation-type-btn:hover {
    border-color: #54c915;
    background: #54c915;
}

.cdm-donation-type-btn.is-active {
    background: #54c915;
    border-color: #54c915;
    color: #fff;
}

.cdm-custom-amount {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cdm-custom-label {
    font-size: 14px;
    font-weight: 600;
    color: #475467;
}

.cdm-custom-input-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.cdm-currency-prefix {
    position: absolute;
    left: 12px;
    font-weight: 700;
    color: #475467;
    pointer-events: none;
}

.cdm-custom-input-wrapper input {
    padding-left: 36px !important;
}

.cdm-donation-form span {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.cdm-donation-form input,
.cdm-donation-form textarea {
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    box-sizing: border-box;
    padding: 11px 12px;
    width: 100%;
}

.cdm-donation-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 4px;
}

.cdm-donation-message {
    border-radius: 10px;
    font-size: 14px;
    min-height: 22px;
    padding: 0;
}

/* Spinner styles */
.cdm-spinner {
    align-items: center;
    display: flex;
    gap: 12px;
}

.cdm-spinner-icon {
    animation: cdm-spin 1s linear infinite;
    border: 3px solid #f3f4f6;
    border-radius: 50%;
    border-top-color: #175cd3;
    height: 24px;
    width: 24px;
}

@keyframes cdm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.cdm-donation-message.is-info,
.cdm-donation-message.is-error,
.cdm-donation-message.is-success {
    padding: 10px 12px;
}

.cdm-donation-message.is-info {
    background: #eff8ff;
    color: #175cd3;
}

.cdm-donation-message.is-error {
    background: #fef3f2;
    color: #b42318;
}

.cdm-donation-message.is-success {
    background: #ecfdf3;
    color: #027a48;
}

body.cdm-front-modal-open {
    overflow: hidden;
}

@keyframes cdm-progress-grow {
    from {
        width: 0;
    }
}

@media (max-width: 768px) {
    .cdm-front-modal {
        padding: 10px;
    }
    
    .cdm-modal-content {
        flex-direction: column;
        max-height: 95vh;
    }
    
    .cdm-modal-left {
        flex: none;
        min-height: auto;
        max-height: 40vh;
    }
    
    .cdm-modal-left img {
        object-fit: contain;
        max-height: 40vh;
        width: 100%;
        height: auto;
    }
    
    .cdm-modal-right {
        flex: 1;
        padding: 25px 20px;
        max-height: 55vh;
    }
    
    .cdm-preset-amounts,
    .cdm-donation-types {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .cdm-card-metrics {
        grid-template-columns: 1fr;
    }

    .cdm-donation-form {
        grid-template-columns: 1fr;
    }

    .cdm-donation-actions {
        flex-direction: column;
    }

    .cdm-preset-amounts,
    .cdm-donation-types {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
