/* Giveaway Frontend Design System - Elite Glassmorphism Edition */

:root {
    --wpsg-primary: #f97316;
    --wpsg-primary-dark: #ea580c;
    --wpsg-success: #10b981;
    --wpsg-bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --wpsg-glass: rgba(255, 255, 255, 0.8);
    --wpsg-glass-border: rgba(255, 255, 255, 0.3);
    --wpsg-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08);
}

.wpsg-giveaway-single {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #1e293b;
    background: var(--wpsg-bg-gradient);
    padding: 6rem 2rem 3rem;
    min-height: 100vh;
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    box-sizing: border-box;
}

.wpsg-giveaway-blocks-container {
    max-width: 800px; /* Wider for 2-column grid */
    margin: 0 auto;
    background: var(--wpsg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 32px;
    border: 1px solid var(--wpsg-glass-border);
    box-shadow: var(--wpsg-shadow);
    overflow: hidden;
    padding-bottom: 2rem;
}

.wpsg-block-title {
    text-align: center;
    padding: 3rem 2rem 1rem;
    font-size: 2.75rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    background: linear-gradient(to bottom right, #1e293b, #475569);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Prizes Grid Section */
.wpsg-prizes-section {
    padding: 2rem;
    background: rgba(255,255,255,0.4);
    margin-bottom: 2rem;
}

.wpsg-section-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    margin-top: 0;
}

.wpsg-prizes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 Column Grid */
    gap: 20px;
    margin-top: 20px;
}

.wpsg-prizes-grid-integrated {
    padding: 0 2rem;
    margin-bottom: 3rem;
}

@media (max-width: 600px) {
    .wpsg-prizes-grid { grid-template-columns: 1fr; }
}

.wpsg-prize-card {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    padding: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.wpsg-prize-card:hover {
    transform: translateY(-8px);
    border-color: var(--wpsg-primary);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.wpsg-prize-card.is-selected {
    border-color: var(--wpsg-primary);
    background: #fff7ed;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.1);
}

.wpsg-prize-image {
    width: 100%;
    height: 180px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
}

.wpsg-prize-info {
    padding-top: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.wpsg-prize-name {
    font-weight: 800;
    margin-bottom: 8px;
    color: #1e293b;
}

.wpsg-prize-desc {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 20px;
    line-height: 1.5;
    flex-grow: 1;
}

.wpsg-prize-select-btn {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: none;
    background: #f1f5f9;
    color: #475569;
    font-weight: 700;
    transition: all 0.2s;
    cursor: pointer;
}

.wpsg-prize-card:hover .wpsg-prize-select-btn {
    background: #e2e8f0;
}

.wpsg-prize-card.is-selected .wpsg-prize-select-btn {
    background: var(--wpsg-primary);
    color: #fff;
}

/* Actions List */
.wpsg-actions-block h3 {
    margin-left: 2rem;
    margin-right: 2rem;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 800;
}

.wpsg-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    margin-bottom: 10px;
    transition: all 0.2s;
    margin-left: 2rem;
    margin-right: 2rem;
}

.wpsg-action-row:hover {
    border-color: var(--wpsg-primary);
    transform: translateX(5px);
}

/* Join Button */
.wpsg-btn-main {
    background: linear-gradient(135deg, var(--wpsg-primary) 0%, var(--wpsg-primary-dark) 100%);
    color: #fff;
    border: none;
    padding: 1.25rem 3rem;
    border-radius: 99px;
    font-size: 1.25rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 25px -5px rgba(249, 115, 22, 0.4);
    transition: all 0.3s;
}

.wpsg-btn-main:hover {
    transform: scale(1.05);
    box-shadow: 0 20px 30px -10px rgba(249, 115, 22, 0.5);
}

.wpsg-btn-main:disabled {
    background: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Rules */
.wpsg-block-rules {
    margin: 3rem 2rem 2rem;
    background: #f8fafc;
    border-radius: 16px;
    padding: 1.5rem;
}

/* Flip Timer Styles */
.wpsg-timer-block {
    text-align: center;
    margin: 3rem auto !important;
    padding: 2rem;
    background: #fff;
    border-radius: 24px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    max-width: 600px;
}

.wpsg-timer-label {
    font-size: 14px;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 25px;
    letter-spacing: 0.1em;
}

.wpsg-flip-timer {
    display: flex;
    justify-content: center;
    gap: 15px;
    perspective: 1000px;
}

.wpsg-timer-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.wpsg-flip-card {
    position: relative;
    width: 70px;
    height: 90px;
    background: #1e293b;
    border-radius: 12px;
    font-size: 48px;
    font-weight: 900;
    color: var(--wpsg-primary);
    line-height: 90px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    display: block;
    margin: 0 auto;
    perspective: 400px; /* Better depth control */
    overflow: visible; /* Need overflow visible for the flip to work, but border-radius must be on segments */
}

.wpsg-flip-top,
.wpsg-flip-bottom,
.wpsg-flip-front,
.wpsg-flip-back {
    position: absolute;
    left: 0;
    width: 100%;
    height: 50%;
    overflow: hidden;
    background: #1e293b;
    text-align: center;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    box-sizing: border-box;
}

.wpsg-flip-top {
    top: 0;
    border-radius: 10px 10px 0 0;
    line-height: 90px;
    z-index: 1;
}

.wpsg-flip-bottom {
    bottom: 0;
    border-radius: 0 0 10px 10px;
    line-height: 0; 
    z-index: 0;
    background: #1e293b;
    border-top: 1px solid rgba(255,255,255,0.05); /* Subtle seam */
}

.wpsg-flip-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    z-index: 5;
    transform-origin: bottom;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.wpsg-flip-front {
    z-index: 2;
    border-radius: 10px 10px 0 0;
    line-height: 90px;
    background: #1e293b;
}

.wpsg-flip-back {
    transform: rotateX(-180deg); /* Counter the flip rotation */
    border-radius: 0 0 10px 10px;
    line-height: 0;
    z-index: 1;
    background: #1e293b;
}

.wpsg-unit-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 700;
}

/* Flip Animation */
.wpsg-flip-timer .flipping .wpsg-flip-inner {
    animation: wpsgFlip 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes wpsgFlip {
    0% { transform: rotateX(0deg); }
    100% { transform: rotateX(-180deg); }
}

/* Responsive Timer */
@media (max-width: 600px) {
    .wpsg-flip-card {
        width: 50px;
        height: 70px;
        font-size: 32px;
        line-height: 70px;
    }
    .wpsg-flip-top { line-height: 70px; }
    .wpsg-flip-front { line-height: 70px; }
    .wpsg-flip-bottom { line-height: 0px; }
    .wpsg-flip-back { line-height: 0px; }
    
    .wpsg-timer-block {
        margin: 1.5rem !important;
        padding: 1.5rem 1rem;
    }
    .wpsg-flip-timer { gap: 8px; }
}

/* Template Adjustments */
.wpsg-template-email_list .wpsg-block-join_form {
    background: #fff;
    padding: 3rem;
    border-radius: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.wpsg-template-social .wpsg-action-row {
    border-left: 4px solid var(--wpsg-primary);
}

.wpsg-template-viral .wpsg-timer-block {
    background: #fff1f2;
    border-color: #fecdd3;
}

.wpsg-template-product .wpsg-prizes-grid {
    grid-template-columns: repeat(2, 1fr);
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 20px;
}

/* Giveaway Archive Styles */
.wpsg-archive-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.wpsg-archive-filters a, .wpsg-view-toggles a {
    padding: 8px 16px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #475569;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wpsg-archive-filters a.active, .wpsg-view-toggles a.active {
    background: var(--wpsg-primary);
    color: #fff;
    border-color: var(--wpsg-primary);
}

.wpsg-giveaways-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.wpsg-giveaways-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.wpsg-giveaway-card {
    background: #fff;
    border-radius: 24px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.wpsg-giveaways-list .wpsg-giveaway-card {
    flex-direction: row;
    height: 200px;
}

.wpsg-giveaway-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border-color: var(--wpsg-card-primary);
}

.wpsg-card-image {
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
    background-color: #f1f5f9;
    /* Soft pattern for fallback */
    background-image: linear-gradient(45deg, rgba(var(--wpsg-card-primary-rgb, 249, 115, 22), 0.05) 25%, transparent 25%, transparent 50%, rgba(var(--wpsg-card-primary-rgb, 249, 115, 22), 0.05) 50%, rgba(var(--wpsg-card-primary-rgb, 249, 115, 22), 0.05) 75%, transparent 75%, transparent);
    background-size: 40px 40px;
}

.wpsg-card-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    z-index: 1;
    pointer-events: none;
}

.wpsg-card-image span.wpsg-badge {
    z-index: 2;
}

.wpsg-giveaways-list .wpsg-card-image {
    width: 300px;
    height: 100%;
    flex-shrink: 0;
}

.wpsg-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.wpsg-badge.active { background: #dcfce7; color: #166534; }
.wpsg-badge.ended { background: #fee2e2; color: #991b1b; }

.wpsg-card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.wpsg-card-content h3 {
    margin: 0 0 10px;
    font-size: 1.25rem;
    font-weight: 800;
}

.wpsg-card-excerpt {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 20px;
    flex-grow: 1;
}

.wpsg-card-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    background: var(--wpsg-card-primary);
    color: #fff;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 700;
    text-align: center;
    transition: all 0.2s;
    width: 100%;
}

.wpsg-card-btn:hover {
    opacity: 0.9;
}

.wpsg-prize-select-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 45px;
}

.wpsg-no-results {
    text-align: center;
    padding: 5rem 2rem;
    background: #fff;
    border: 2px dashed #e2e8f0;
    border-radius: 32px;
    grid-column: 1 / -1;
    width: 100%;
}

.wpsg-no-results-icon {
    font-size: 64px;
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    color: #cbd5e1;
}

.wpsg-no-results h3 {
    margin: 0 0 10px;
    color: #1e293b;
    font-size: 1.5rem;
}

.wpsg-no-results p {
    color: #64748b;
    max-width: 400px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .wpsg-giveaways-list .wpsg-giveaway-card {
        flex-direction: column;
        height: auto;
    }
    .wpsg-giveaways-list .wpsg-card-image {
        width: 100%;
        height: 200px;
    }
}
