/**
 * Campaign Display CSS
 * RaiseFi 3.0 Core Plugin - Frontend Campaign Template Styling
 * 
 * @package RaiseFi_3.0
 * @version 3.0.0
 * @since 3.0.0
 */

/* ==========================================================================
   Campaign Container & Layout
   ========================================================================== */

.raisefi-campaign-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.raisefi-campaign-single {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Campaign Header */
.campaign-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    position: relative;
}

.campaign-header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 15px;
}

.campaign-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    flex: 1;
    min-width: 300px;
}

.campaign-status-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.campaign-status-badge.status-active {
    background: rgba(40, 167, 69, 0.9);
}

.campaign-status-badge.status-funded {
    background: rgba(40, 167, 69, 0.9);
}

.campaign-status-badge.status-expired {
    background: rgba(220, 53, 69, 0.9);
}

.campaign-network-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
}

.network-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.network-icon.network-ethereum {
    background: #627eea;
}

.network-icon.network-sepolia {
    background: #627eea;
}

.network-icon.network-apechain {
    background: #ff6b35;
}

.network-icon.network-curtis {
    background: #ff6b35;
}

/* ==========================================================================
   Campaign Layout - Main Content + Sidebar
   ========================================================================== */

.campaign-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    padding: 30px;
}

.campaign-main-content {
    min-width: 0; /* Prevent overflow */
}

.campaign-rewards-sidebar {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

/* ==========================================================================
   Campaign Featured Image
   ========================================================================== */

.campaign-featured-image {
    margin-bottom: 30px;
    border-radius: 6px;
    overflow: hidden;
}

.campaign-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    display: block;
}

/* ==========================================================================
   Campaign Details Section
   ========================================================================== */

.campaign-details {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.campaign-description {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #333;
}

.campaign-description p {
    margin-bottom: 1.2em;
}

.campaign-description h3 {
    color: #667eea;
    margin-top: 2em;
    margin-bottom: 1em;
}

/* ==========================================================================
   Funding Progress Section
   ========================================================================== */

.funding-progress-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #e9ecef;
}

.funding-progress-section h3 {
    margin: 0 0 20px 0;
    color: #495057;
    font-size: 1.3rem;
}

.funding-progress-bar {
    background: #e9ecef;
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    margin-bottom: 15px;
    position: relative;
}

.progress-fill {
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease-in-out;
    position: relative;
}

.funding-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-label {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 5px;
    font-weight: 500;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #495057;
}

/* ==========================================================================
   Campaign Timer Section
   ========================================================================== */

.campaign-timer-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
}

.campaign-timer-section h3 {
    margin: 0 0 20px 0;
    font-size: 1.3rem;
}

.campaign-countdown {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.countdown-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 5px;
}

.countdown-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.countdown-expired {
    font-size: 1.2rem;
    font-weight: 600;
    color: #ffc107;
}

/* ==========================================================================
   Campaign Actions
   ========================================================================== */

.campaign-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.campaign-modal-trigger {
    position: relative;
    overflow: hidden;
}

.campaign-modal-trigger::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.campaign-modal-trigger:hover::before {
    left: 100%;
}

/* ==========================================================================
   Rewards Sidebar
   ========================================================================== */

.rewards-container h3 {
    margin: 0 0 20px 0;
    color: #495057;
    font-size: 1.3rem;
    text-align: center;
}

.reward-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.reward-card:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.reward-card.highlighted {
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
    transform: scale(1.02);
    background: linear-gradient(135deg, #fff 0%, #f8f9ff 100%);
}

.reward-image {
    margin-bottom: 15px;
    border-radius: 6px;
    overflow: hidden;
}

.reward-thumbnail {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.reward-content {
    text-align: center;
}

.reward-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #495057;
}

.reward-description {
    font-size: 0.9rem;
    color: #6c757d;
    margin: 0 0 15px 0;
    line-height: 1.4;
}

.reward-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.reward-price {
    font-weight: 700;
    color: #667eea;
    font-size: 1.1rem;
}

.reward-stock {
    color: #28a745;
    font-weight: 500;
}

.btn-reward {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    width: 100%;
    margin-top: 10px;
}

.btn-reward:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.no-rewards-message {
    text-align: center;
    padding: 30px;
    color: #6c757d;
}

.no-rewards-message p {
    margin-bottom: 20px;
}

.contribute-no-reward-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* ==========================================================================
   Chat System
   ========================================================================== */

.campaign-chat-section {
    margin-top: 40px;
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.chat-status {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.chat-container {
    height: 400px;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: white;
}

.chat-input-container {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.chat-form {
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
    outline: none;
}

.chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.chat-send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* ==========================================================================
   Comments Section
   ========================================================================== */

.campaign-comments-section {
    margin-top: 40px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

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

/* Tablet */
@media (max-width: 1024px) {
    .campaign-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .campaign-rewards-sidebar {
        position: static;
        order: -1;
    }
    
    .campaign-title {
        font-size: 2rem;
    }
    
    .funding-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .raisefi-campaign-container {
        padding: 10px;
    }
    
    .campaign-header {
        padding: 20px;
    }
    
    .campaign-header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .campaign-title {
        font-size: 1.8rem;
        min-width: auto;
    }
    
    .campaign-layout {
        padding: 20px;
        gap: 15px;
    }
    
    .campaign-rewards-sidebar {
        padding: 20px;
    }
    
    .funding-progress-section,
    .campaign-timer-section {
        padding: 20px;
    }
    
    .funding-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .campaign-countdown {
        gap: 15px;
    }
    
    .countdown-number {
        font-size: 1.5rem;
    }
    
    .campaign-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn {
        min-width: auto;
        width: 100%;
    }
    
    .reward-card {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .chat-container {
        height: 300px;
    }
    
    .chat-header,
    .chat-input-container {
        padding: 15px;
    }
    
    .chat-messages {
        padding: 15px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .campaign-title {
        font-size: 1.5rem;
    }
    
    .countdown-item {
        min-width: 50px;
    }
    
    .countdown-number {
        font-size: 1.2rem;
    }
    
    .countdown-label {
        font-size: 0.7rem;
    }
    
    .reward-thumbnail {
        height: 100px;
    }
    
    .chat-form {
        flex-direction: column;
        gap: 10px;
    }
    
    .chat-send-btn {
        align-self: flex-end;
        min-width: 80px;
    }
}

/* ==========================================================================
   Animations & Effects
   ========================================================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.raisefi-campaign-single {
    animation: fadeInUp 0.6s ease-out;
}

.reward-card {
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

.reward-card:nth-child(1) { animation-delay: 0.1s; }
.reward-card:nth-child(2) { animation-delay: 0.2s; }
.reward-card:nth-child(3) { animation-delay: 0.3s; }
.reward-card:nth-child(4) { animation-delay: 0.4s; }

/* Pulse effect for highlighted rewards */
@keyframes pulse {
    0%, 100% { 
        transform: scale(1.02); 
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
    }
    50% { 
        transform: scale(1.05); 
        box-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
    }
}

.reward-card.pulse-effect {
    animation: pulse 2s ease-in-out;
}

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

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles */
.btn:focus,
.chat-input:focus,
.chat-send-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .campaign-header {
        background: #000;
        color: #fff;
    }
    
    .btn-primary {
        background: #000;
        border: 2px solid #fff;
    }
    
    .reward-card {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .progress-fill {
        transition: none;
    }
}

/* Print styles */
@media print {
    .campaign-actions,
    .chat-section,
    .campaign-comments-section {
        display: none;
    }
    
    .raisefi-campaign-single {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .campaign-header {
        background: #f0f0f0 !important;
        color: #000 !important;
    }
}

/* ==========================================================================
   Shipping Regions Display
   ========================================================================== */

.campaign-shipping {
    font-size: 0.95rem;
    color: #444;
    margin: 8px 0;
}

.campaign-shipping strong {
    color: #333;
}

.ships-worldwide {
    color: #28a745;
    font-weight: 600;
}

.shipping-restriction-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
}

.shipping-warning {
    color: #856404;
    margin: 0;
    font-size: 0.9rem;
}

.shipping-warning strong {
    color: #664d03;
}
