/**
 * RaiseFi Campaign Cards Shortcode Styles
 * 
 * Styles for the [raisefi_campaign_cards] shortcode
 * Used on homepage, landing pages, and content blocks
 * 
 * @package RaiseFi_Core
 * @since 3.0.0
 */

/* ==========================================================================
   Container & Grid
   ========================================================================== */

.raisefi-campaign-cards-wrap {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.raisefi-cards-heading {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e3a5f;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.raisefi-campaign-cards-grid {
    display: grid;
    gap: 20px;
}

.raisefi-cards-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.raisefi-cards-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.raisefi-cards-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.raisefi-cards-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 1.1rem;
    background: #f9fafb;
    border-radius: 12px;
}

/* ==========================================================================
   Card Base Styles
   ========================================================================== */

.raisefi-sc-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.raisefi-sc-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   Ribbon / Badge
   ========================================================================== */

.raisefi-sc-ribbon {
    position: absolute;
    top: 12px;
    left: -5px;
    padding: 4px 12px 4px 12px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.raisefi-sc-ribbon::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    border-width: 5px 0 0 5px;
    border-style: solid;
}

.raisefi-sc-ribbon.ribbon-live {
    background: #22c55e;
}

.raisefi-sc-ribbon.ribbon-live::before {
    border-color: #166534 transparent transparent #166534;
}

.raisefi-sc-ribbon.ribbon-funded {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.raisefi-sc-ribbon.ribbon-funded::before {
    border-color: #92400e transparent transparent #92400e;
}

.raisefi-sc-ribbon.ribbon-ended {
    background: #6b7280;
}

.raisefi-sc-ribbon.ribbon-ended::before {
    border-color: #374151 transparent transparent #374151;
}

.raisefi-sc-ribbon.ribbon-launching {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.raisefi-sc-ribbon.ribbon-launching::before {
    border-color: #5b21b6 transparent transparent #5b21b6;
}

/* ==========================================================================
   Thumbnail & Image Container
   ========================================================================== */

.raisefi-sc-image-container {
    position: relative;
}

.raisefi-sc-thumb {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

/* Campaign Countdown Overlay */
.raisefi-sc-card .campaign-countdown-overlay {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.raisefi-sc-card .campaign-countdown-overlay.urgent {
    background: rgba(239, 68, 68, 0.95);
    animation: countdown-pulse 2s ease-in-out infinite;
}

.raisefi-sc-card .campaign-countdown-overlay.critical {
    background: rgba(220, 38, 38, 0.98);
    animation: countdown-pulse 1.5s ease-in-out infinite;
}

@keyframes countdown-pulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 2px 16px rgba(239, 68, 68, 0.8); }
}

/* ==========================================================================
   Content Area
   ========================================================================== */

.raisefi-sc-content {
    padding: 16px;
}

.raisefi-sc-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.raisefi-sc-left {
    flex: 1;
    min-width: 0;
}

.raisefi-sc-category {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #3b82f6;
    display: block;
    margin-bottom: 4px;
}

.raisefi-sc-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.raisefi-sc-icons {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.raisefi-sc-badge,
.raisefi-sc-chain {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.raisefi-sc-badge svg,
.raisefi-sc-chain img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.raisefi-sc-tagline {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.3;
    margin: 0 0 8px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

/* ==========================================================================
   Funding Row - 65% PFP / 35% Funding Bar (matching creator profile)
   ========================================================================== */

.raisefi-sc-funding-row {
    display: grid;
    grid-template-columns: 65% 35%;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.raisefi-sc-creator {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.raisefi-sc-pfp-link {
    display: block;
    text-decoration: none;
    flex-shrink: 0;
}

.raisefi-sc-pfp {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    background: #e5e7eb;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.raisefi-sc-pfp-link:hover .raisefi-sc-pfp {
    opacity: 0.85;
}

.raisefi-sc-creator-name {
    font-size: 0.9rem;
    color: #374151;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.raisefi-sc-funding-wrap {
    min-width: 0;
    padding-right: 12px;
}

.raisefi-sc-goal {
    font-size: 0.65rem;
    color: #6b7280;
    margin-bottom: 2px;
    text-align: right;
}

.raisefi-sc-progress {
    height: 5px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 2px;
}

.raisefi-sc-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.raisefi-sc-progress-bar.state-expired {
    background: linear-gradient(90deg, #9ca3af, #6b7280);
}

.raisefi-sc-percent {
    font-size: 0.65rem;
    color: #6b7280;
    text-align: right;
}

.raisefi-sc-percent strong {
    color: #22c55e;
}

.raisefi-sc-time-left {
    color: #dc2626;
    font-weight: 500;
}

/* ==========================================================================
   Buttons - Matching creator profile styling
   ========================================================================== */

.raisefi-sc-buttons {
    display: flex;
    gap: 6px;
}

.raisefi-sc-btn {
    flex: 1;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.raisefi-sc-btn-fund {
    background: #28a745;
    color: #ffffff !important;
}

.raisefi-sc-btn-fund:hover {
    background: #218838;
    color: #ffffff !important;
}

.raisefi-sc-btn-fund.state-funded {
    background: #d97706;
    cursor: not-allowed;
}

.raisefi-sc-btn-fund.state-funded:hover {
    background: #d97706;
}

.raisefi-sc-btn-fund.state-expired {
    background: #9ca3af;
    cursor: not-allowed;
}

.raisefi-sc-btn-fund.state-expired:hover {
    background: #9ca3af;
}

.raisefi-sc-btn-fund.state-launching {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    cursor: not-allowed;
}

.raisefi-sc-btn-fund.state-launching:hover {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.raisefi-sc-btn-info {
    background: transparent;
    color: #1e3a5f;
    border: 2px solid #FF9500;
}

.raisefi-sc-btn-info:hover {
    background: rgba(255, 149, 0, 0.1);
    color: #153050;
    border-color: #e6850e;
}

/* ==========================================================================
   Modal Styles
   ========================================================================== */

.raisefi-sc-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.raisefi-sc-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.raisefi-sc-modal-container {
    position: relative;
    background: #fff;
    border-radius: 16px;
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.raisefi-sc-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.raisefi-sc-modal-close:hover {
    background: #e5e7eb;
    color: #1e3a5f;
}

.raisefi-sc-modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0 0 20px 0;
    padding-right: 40px;
}

.raisefi-sc-modal-body {
    /* Content styling */
}

.raisefi-sc-loading {
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

/* Rewards Grid in Modal */
.raisefi-sc-rewards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.raisefi-sc-reward-card {
    background: #f9fafb;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    transition: border-color 0.2s, transform 0.2s;
}

.raisefi-sc-reward-card:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
}

.raisefi-sc-reward-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 0.85rem;
}

.raisefi-sc-reward-content {
    padding: 12px;
}

.raisefi-sc-reward-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e3a5f;
    margin-bottom: 6px;
}

.raisefi-sc-reward-desc {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 10px;
    line-height: 1.4;
}

.raisefi-sc-reward-price {
    font-size: 1rem;
    font-weight: 700;
    color: #22c55e;
    margin-bottom: 6px;
}

.raisefi-sc-reward-qty {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 10px;
}

.raisefi-sc-reward-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: #1e3a5f;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.2s;
}

.raisefi-sc-reward-btn:hover {
    background: #153050;
    color: #fff;
}

.raisefi-sc-reward-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.raisefi-sc-view-campaign {
    display: block;
    text-align: center;
    padding: 14px 24px;
    background: #e5e7eb;
    color: #374151;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.2s;
}

.raisefi-sc-view-campaign:hover {
    background: #d1d5db;
    color: #1e3a5f;
}

.raisefi-sc-empty {
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

/* ==========================================================================
   Card Style Variations
   ========================================================================== */

/* Compact Style */
.raisefi-cards-style-compact .raisefi-sc-thumb {
    height: 140px;
}

.raisefi-cards-style-compact .raisefi-sc-content {
    padding: 12px;
}

.raisefi-cards-style-compact .raisefi-sc-tagline {
    display: none;
}

.raisefi-cards-style-compact .raisefi-sc-creator-name {
    display: none;
}

/* Minimal Style */
.raisefi-cards-style-minimal .raisefi-sc-thumb {
    height: 120px;
}

.raisefi-cards-style-minimal .raisefi-sc-content {
    padding: 10px;
}

.raisefi-cards-style-minimal .raisefi-sc-tagline,
.raisefi-cards-style-minimal .raisefi-sc-creator,
.raisefi-cards-style-minimal .raisefi-sc-icons {
    display: none;
}

.raisefi-cards-style-minimal .raisefi-sc-meta-row {
    margin-bottom: 12px;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 1200px) {
    .raisefi-cards-cols-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .raisefi-cards-cols-3,
    .raisefi-cards-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .raisefi-campaign-cards-wrap {
        padding: 16px;
    }
    
    .raisefi-cards-heading {
        font-size: 1.4rem;
    }
    
    .raisefi-cards-cols-2,
    .raisefi-cards-cols-3,
    .raisefi-cards-cols-4 {
        grid-template-columns: 1fr;
    }
    
    .raisefi-sc-thumb {
        height: 200px;
    }
    
    /* Stack the funding row on mobile */
    .raisefi-sc-funding-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .raisefi-sc-creator {
        order: 1;
    }
    
    .raisefi-sc-funding-wrap {
        order: 2;
        padding-right: 0;
    }
    
    .raisefi-sc-goal,
    .raisefi-sc-percent {
        text-align: left;
    }
    
    .raisefi-sc-modal-container {
        width: 95%;
        padding: 16px;
        max-height: 90vh;
    }
    
    .raisefi-sc-rewards-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .raisefi-sc-buttons {
        flex-direction: column;
    }
    
    .raisefi-sc-btn {
        width: 100%;
    }
}
