/* Modern Campaign Module Styles */
.jd-campaigns-wrapper {
    padding: 20px 0;
}

.jd-campaigns-grid {
    display: grid;
    gap: 30px;
    margin-bottom: 30px;
}

.jd-campaigns-grid.columns-1 {
    grid-template-columns: 1fr;
}

.jd-campaigns-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.jd-campaigns-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.jd-campaigns-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Responsive */
@media (max-width: 992px) {
    .jd-campaigns-grid.columns-3,
    .jd-campaigns-grid.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .jd-campaigns-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Campaign Card */
.jd-campaign-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.jd-campaign-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
}

/* Parent Campaign Badge */
.jd-parent-campaign-badge {
    background: linear-gradient(135deg, #ff8c42 0%, #ff6b35 100%);
    color: #fff;
    padding: 8px 15px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.jd-parent-campaign-badge i {
    font-size: 14px;
}

.jd-parent-campaign-name {
    opacity: 0.95;
    font-weight: 500;
}

/* Parent Badge (for campaigns that have children) */
.jd-parent-campaign-badge.jd-parent-badge {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    justify-content: space-between;
}

.jd-child-count-badge {
    background: rgba(255, 255, 255, 0.25);
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 11px;
    margin-left: auto;
}

/* Campaign Image */
.jd-campaign-image {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: #f5f5f5;
}

.jd-campaign-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.jd-campaign-card:hover .jd-campaign-image img {
    transform: scale(1.05);
}

/* Campaign Content */
.jd-campaign-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.jd-campaign-title {
    font-size: 20px;
    font-weight: 700;
    color: #2d3748;
    margin: 0 0 12px 0;
    line-height: 1.4;
}

.jd-campaign-description {
    color: #718096;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
    flex: 1;
}

/* Campaign Meta Info */
.jd-campaign-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.jd-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #4a5568;
}

.jd-meta-item i {
    color: #ff8c42;
    font-size: 14px;
}

.jd-meta-item strong {
    font-weight: 600;
    color: #2d3748;
}

/* Special styling for child campaigns meta item */
.jd-meta-item.jd-meta-child-campaigns i {
    color: #4CAF50;
}

.jd-meta-item.jd-meta-child-campaigns {
    background: #f1f8f4;
    padding: 6px 12px;
    border-radius: 6px;
    width: 100%;
}

/* Progress Section */
.jd-campaign-progress {
    margin-bottom: 20px;
}

.jd-progress-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.jd-stat-box {
    text-align: center;
    flex: 1;
}

.jd-stat-box:first-child {
    text-align: left;
}

.jd-stat-box:last-child {
    text-align: right;
}

.jd-stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 4px;
}

.jd-stat-label {
    display: block;
    font-size: 12px;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Progress Bar */
.jd-progress-bar-wrapper {
    position: relative;
    height: 8px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.jd-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff8c42 0%, #ff6b35 100%);
    border-radius: 10px;
    transition: width 0.6s ease;
    position: relative;
}

.jd-progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Donate Button */
.jd-campaign-action {
    margin-top: auto;
}

.jd-donate-button {
    display: block;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #ff8c42 0%, #ff6b35 100%);
    color: #fff;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.jd-donate-button:hover {
    background: linear-gradient(135deg, #ff7a2e 0%, #ff5821 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 140, 66, 0.4);
    color: #fff;
    text-decoration: none;
}

.jd-donate-button:active {
    transform: translateY(0);
}

/* Empty State */
.jd-campaigns-empty {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.jd-campaigns-empty i {
    font-size: 48px;
    color: #cbd5e0;
    margin-bottom: 16px;
}

/* Loading State */
.jd-campaigns-loading {
    text-align: center;
    padding: 40px;
}

.jd-campaigns-loading i {
    font-size: 32px;
    color: #ff8c42;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* ========================================
   Campaign Module Title with Action Icons
   ======================================== */

.jd-campaign-title-wrapper {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.jd-campaign-title-wrapper .jd-campaign-title {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #2d3748;
    line-height: 1.4;
}

.jd-campaign-actions-module {
    display: flex;
    gap: 5px;
    align-items: flex-start;
    flex-shrink: 0;
    padding-top: 2px;
}

.jd-icon-action-module {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    position: relative;
    cursor: pointer;
}

/* Tooltip on hover */
.jd-icon-action-module::before {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background-color: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.jd-icon-action-module::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.jd-icon-action-module:hover::before,
.jd-icon-action-module:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}

/* Edit Icon Style */
.jd-icon-action-module.jd-edit-action {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: #fff !important;
}

.jd-icon-action-module.jd-edit-action:hover {
    background: linear-gradient(135deg, #f57c00 0%, #e65100 100%);
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 6px 16px rgba(255, 152, 0, 0.4);
}

.jd-icon-action-module.jd-edit-action:active {
    transform: translateY(-1px) scale(1.05);
}

/* Donors Icon Style */
.jd-icon-action-module.jd-donors-action {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: #fff !important;
}

.jd-icon-action-module.jd-donors-action:hover {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 6px 16px rgba(33, 150, 243, 0.4);
}

.jd-icon-action-module.jd-donors-action:active {
    transform: translateY(-1px) scale(1.05);
}

.jd-icon-action-module svg {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
}

.jd-icon-action-module:hover svg {
    transform: rotate(5deg);
}

/* Smooth entrance animation */
@keyframes iconSlideIn {
    from {
        opacity: 0;
        transform: translateX(10px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.jd-campaign-actions-module .jd-icon-action-module {
    animation: iconSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.jd-campaign-actions-module .jd-icon-action-module:nth-child(1) {
    animation-delay: 0.1s;
}

.jd-campaign-actions-module .jd-icon-action-module:nth-child(2) {
    animation-delay: 0.2s;
}

/* Pulse effect on hover */
@keyframes iconPulse {
    0%, 100% {
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    }
    50% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
}

.jd-icon-action-module:hover {
    animation: iconPulse 1s ease-in-out infinite;
}

/* Responsive Design for Module */
@media screen and (max-width: 992px) {
    .jd-campaign-title-wrapper .jd-campaign-title {
        font-size: 18px;
    }
    
    .jd-icon-action-module {
        width: 30px;
        height: 30px;
    }
    
    .jd-icon-action-module svg {
        width: 15px;
        height: 15px;
    }
}

@media screen and (max-width: 768px) {
    .jd-campaign-title-wrapper {
        gap: 8px;
    }
    
    .jd-campaign-title-wrapper .jd-campaign-title {
        font-size: 17px;
    }
    
    .jd-icon-action-module {
        width: 28px;
        height: 28px;
    }
    
    .jd-icon-action-module svg {
        width: 14px;
        height: 14px;
    }
    
    .jd-icon-action-module::before {
        font-size: 10px;
        padding: 5px 8px;
    }
}

@media screen and (max-width: 576px) {
    .jd-campaign-title-wrapper {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .jd-campaign-title-wrapper .jd-campaign-title {
        width: 100%;
        font-size: 16px;
    }
    
    .jd-campaign-actions-module {
        width: 100%;
        justify-content: flex-end;
        padding-top: 0;
    }
    
    .jd-icon-action-module {
        width: 32px;
        height: 32px;
    }
    
    .jd-icon-action-module svg {
        width: 15px;
        height: 15px;
    }
}

/* Special handling for single column layout */
.jd-campaigns-grid.columns-1 .jd-campaign-title-wrapper .jd-campaign-title {
    font-size: 22px;
}

.jd-campaigns-grid.columns-1 .jd-icon-action-module {
    width: 36px;
    height: 36px;
}

.jd-campaigns-grid.columns-1 .jd-icon-action-module svg {
    width: 18px;
    height: 18px;
}

/* Special handling for 4 column layout */
.jd-campaigns-grid.columns-4 .jd-campaign-title-wrapper {
    gap: 6px;
}

.jd-campaigns-grid.columns-4 .jd-campaign-title-wrapper .jd-campaign-title {
    font-size: 17px;
}

.jd-campaigns-grid.columns-4 .jd-icon-action-module {
    width: 28px;
    height: 28px;
}

.jd-campaigns-grid.columns-4 .jd-icon-action-module svg {
    width: 14px;
    height: 14px;
}

/* Ensure icons work well with parent/child campaign badges */
.jd-parent-campaign-badge + .jd-campaign-image + .jd-campaign-content .jd-campaign-title-wrapper {
    margin-top: 0;
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
    .jd-icon-action-module {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .jd-icon-action-module::before {
        background-color: rgba(0, 0, 0, 0.95);
    }
    
    .jd-icon-action-module::after {
        border-top-color: rgba(0, 0, 0, 0.95);
    }
}

/* Accessibility improvements */
.jd-icon-action-module:focus {
    outline: 2px solid #4299e1;
    outline-offset: 2px;
}

.jd-icon-action-module:focus:not(:focus-visible) {
    outline: none;
}

/* Print styles - hide action icons when printing */
@media print {
    .jd-campaign-actions-module {
        display: none !important;
    }
    
    .jd-campaign-title-wrapper .jd-campaign-title {
        width: 100%;
    }
}
