/* Global Form Styles (Submission and Voting) */
.cpv-form-wrapper,
.cpv-entry-card {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.cpv-form-wrapper {
    max-width: 600px;
    margin: 20px auto;
    padding: 30px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.cpv-form-header {
    font-size: 1.8em;
    color: #333;
    margin-top: 0;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
    margin-bottom: 25px;
}

.cpv-form-content p,
.cpv-voting-form p {
    margin-bottom: 15px;
}

.cpv-form-content label,
.cpv-voting-form label {
    display: block;
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
}

.cpv-form-content input[type="text"],
.cpv-form-content input[type="url"],
.cpv-form-content textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

/* --- Slider Specific Styles --- */
.cpv-criterion-group {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #eee;
}

.cpv-slider-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.cpv-score-slider {
    flex-grow: 1;
    /* Reset range input styling */
    -webkit-appearance: none;
    appearance: none;
    background: #f0f0f0;
    height: 8px;
    border-radius: 5px;
    cursor: pointer;
    margin: 0;
    padding: 0;
}

.cpv-score-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0073aa;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.cpv-current-score-display,
.cpv-slider-max {
    font-weight: bold;
    color: #0073aa;
    width: 25px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    /* Align numbers */
}

.cpv-current-score-display {
    color: #333;
}

.cpv-total-score-display {
    text-align: right;
    font-size: 1.1em;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 2px solid #ddd;
}

/* --- End Slider Specific Styles --- */


.cpv-form-content input:focus,
.cpv-form-content textarea:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 5px rgba(0, 115, 170, 0.2);
}

.cpv-form-content textarea {
    resize: vertical;
}

.cpv-form-content input[type="file"] {
    padding: 5px 0;
}

/* Status/Alert Messages */
.cpv-submission-alert,
.cpv-error,
.cpv-success,
.cpv-info,
.cpv-alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: bold;
    border: 1px solid transparent;
}

.cpv-success {
    background-color: #e6ffed;
    color: #1a8f3b;
    border-color: #1a8f3b;
}

.cpv-error {
    background-color: #ffe6e6;
    color: #d63638;
    border-color: #d63638;
}

.cpv-info,
.cpv-alert {
    background-color: #e6f7ff;
    color: #0073aa;
    border-color: #0073aa;
}

.cpv-form-status-small {
    font-size: 0.9em;
    color: #666;
}

.cpv-loading-status {
    color: #0073aa !important;
    font-style: italic;
}

/* Widget Styling */
.cpv-entries-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
    /* Align cards to the start */
}

.cpv-entry-card {
    border: 1px solid #ddd !important;
    padding: 15px !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08) !important;
    transition: transform 0.2s;
    background-color: #fff;
    width: 100%;
    /* Ensure card takes full width in container context if needed, or let flex handle it */
    max-width: 300px;
    /* Limit card width */
}

.cpv-entry-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.cpv-entry-card img {
    border-radius: 6px !important;
    max-width: 100%;
    height: auto;
    object-fit: cover;
    margin: 0 auto 10px auto;
    display: block;
}

.cpv-entry-card h4 {
    font-size: 1.3em;
    margin: 0 0 10px 0;
    color: #333;
}

.cpv-entry-card small {
    color: #777;
}

.cpv-entry-snippet {
    font-size: 0.9em;
    line-height: 1.4em;
    margin-bottom: 10px;
    color: #555;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    /* Standard property for compatibility */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cpv-results-container h5 {
    font-size: 1em;
    color: #0073aa;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.cpv-results-container ul {
    margin: 0 0 15px 0 !important;
    padding: 0 !important;
}

.cpv-results-container li {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    font-size: 0.9em !important;
    padding: 3px 0;
}

.cpv-voted-status {
    background-color: #e6f7ff !important;
    color: #0073aa !important;
    border: 1px solid #0073aa;
    padding: 8px;
    border-radius: 4px;
    font-weight: bold;
    text-align: center;
}

.cpv-voting-form h5 {
    font-size: 1.1em;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.cpv-voting-form button {
    padding: 10px 15px;
    font-size: 1em;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.cpv-voting-form button:hover:not(:disabled) {
    background-color: #005684 !important;
}

/* Responsive adjustments for widget */
@media (max-width: 768px) {
    .cpv-entries-container {
        flex-direction: column;
        gap: 15px;
    }

    .cpv-entry-card {
        max-width: 100%;
    }
}

/* --- Stepper Styles --- */
.cpv-stepper-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.cpv-stepper-btn {
    width: 30px;
    height: 30px;
    padding: 0 !important;
    /* Override default button padding */
    line-height: 1;
    text-align: center;
    font-weight: bold;
    cursor: pointer;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cpv-stepper-btn:hover {
    background: #e0e0e0;
}

.cpv-score-stepper-input {
    width: 60px !important;
    text-align: center;
    margin: 0 !important;
    font-weight: bold;
    /* Hide spinner */
    -moz-appearance: textfield;
    appearance: textfield;
    /* Standard property */
}

.cpv-score-stepper-input::-webkit-outer-spin-button,
.cpv-score-stepper-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* --- Lightbox Styles --- */
.cpv-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    /* Ensure it's on top of everything */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.cpv-lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cpv-lightbox-content {
    position: relative;
    max-width: 95%;
    max-height: 95%;
    width: 900px;
    /* Optional: max width for desktop */
    background: #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.cpv-lightbox-body {
    display: flex;
    flex-direction: row;
    /* Side-by-side on desktop */
    max-height: 90vh;
    overflow: hidden;
}

.cpv-lightbox-image-container {
    flex: 2;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cpv-lightbox-image-container img {
    display: block;
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Video Support */
.cpv-lightbox-image-container.has-video iframe {
    max-width: 100%;
    max-height: 90vh;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
}

.cpv-lightbox-info {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    /* Scrollable description */
    min-width: 300px;
    background: #fff;
    border-left: 1px solid #ddd;
}

.cpv-lightbox-info h3 {
    margin-top: 0;
    font-size: 1.5em;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
    margin-bottom: 15px;
    color: #333;
}

.cpv-lightbox-desc {
    font-size: 1em;
    line-height: 1.6;
    color: #555;
    white-space: pre-wrap;
    /* Preserve line breaks */
}

/* Responsive: Stack on mobile */
@media (max-width: 768px) {
    .cpv-lightbox-body {
        flex-direction: column;
        max-height: 90vh;
        overflow-y: auto;
    }

    .cpv-lightbox-image-container {
        flex: none;
        width: 100%;
        max-height: 50vh;
    }

    .cpv-lightbox-image-container img {
        max-height: 50vh;
    }

    .cpv-lightbox-info {
        flex: none;
        width: 100%;
        min-width: 0;
        border-left: none;
        border-top: 1px solid #ddd;
    }
}

.cpv-lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #fff;
    /* May need to change depending on background overlap, but let's stick to consistent absolute positioning */
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    line-height: 1;
    padding: 0;
    transition: background 0.2s;
}

.cpv-lightbox-close:hover {
    color: #ccc;
}

.cpv-lightbox-trigger {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* --- Carousel Styles --- */
.cpv-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cpv-carousel-slides {
    position: relative;
    width: auto;
    min-width: 0;
    order: 2;
    flex-grow: 1;
    text-align: center;
}

.cpv-carousel-slide {
    display: none;
    width: 100%;
    animation: fadeIn 0.3s ease-in-out;
}

.cpv-carousel-slide.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.cpv-carousel-nav {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 5px 0;
    cursor: pointer;
    border-radius: 3px;
    font-weight: bold;
    flex-shrink: 0;
    width: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cpv-carousel-nav:hover {
    background: rgba(0, 0, 0, 0.8);
}

.cpv-prev {
    order: 1;
    margin-right: 5px;
}

.cpv-next {
    order: 3;
    margin-left: 5px;
}

.cpv-image-label {
    display: block;
    text-align: center;
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

@keyframes fadeIn {
    from {
        opacity: 0.5;
    }

    to {
        opacity: 1;
    }
}

/* --- Leaderboard Styles --- */
.cpv-leaderboard-container {
    width: 100%;
}

.cpv-leaderboard-card {
    transition: transform 0.2s, box-shadow 0.2s;
    background: #fff;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 8px;
}

.cpv-leaderboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.cpv-rank-badge {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.cpv-rank-score {
    color: #444;
}

/* Responsive Grid for Leaderboard */
@media (max-width: 768px) {
    .cpv-leaderboard-container {
        grid-template-columns: repeat(2, 1fr) !important;
        /* Force 2 cols on tablet */
    }
}

@media (max-width: 480px) {
    .cpv-leaderboard-container {
        grid-template-columns: 1fr !important;
        /* Force 1 col on mobile */
    }
}

/* Social Links List */
.cpv-social-links-container {
    margin-top: 10px;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.cpv-social-links-list {
    list-style: none !important;
    margin: 5px 0 0 0 !important;
    padding: 0 !important;
}

.cpv-social-links-list li {
    margin-bottom: 3px;
    padding-left: 0;
}

.cpv-social-links-list li a,
.cpv-social-links-list li span {
    display: inline-block;
}

/* --- Widget Controls --- */
.cpv-widget-controls {
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.cpv-control-group {
    display: flex;
    align-items: center;
}

.cpv-control-group label {
    margin-right: 10px;
    font-weight: 600;
    color: #555;
    font-size: 0.95em;
}

.cpv-sort-select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
    color: #333;
    background-color: #fff;
    cursor: pointer;
    min-width: 200px;
}

.cpv-sort-select:focus {
    border-color: #0073aa;
    outline: none;
}

.cpv-filter-toggle {
    cursor: pointer;
    width: 20px;
    height: 20px;
}

/* Loading Overlay */
.cpv-loading-overlay {
    background: rgba(255, 255, 255, 0.85) !important;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Responsive Controls */
@media (max-width: 600px) {
    .cpv-widget-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .cpv-control-group {
        width: 100%;
        justify-content: space-between;
    }

    .cpv-sort-select {
        flex-grow: 1;
        min-width: 0;
    }
}

/* --- Report Modal Styles --- */
.cpv-report-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.cpv-report-modal {
    background: #fff;
    width: 90%;
    max-width: 500px;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
}

.cpv-report-modal h3 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    color: #d63638;
    /* Red for alert/report */
}

.cpv-report-modal textarea {
    width: 100%;
    height: 100px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 15px;
    font-family: inherit;
    resize: vertical;
}

.cpv-report-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.cpv-report-cancel {
    background: #f0f0f0;
    border: 1px solid #ccc;
    color: #333;
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 4px;
}

.cpv-report-submit {
    background: #d63638;
    color: #fff;
    border: none;
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 4px;
}

.cpv-report-submit:hover {
    background: #a00;
}