/**
 * CSS del Frontend - Prompt Secreto Pro
 */

/* Variables */
:root {
    --psp-primary: #667eea;
    --psp-secondary: #764ba2;
    --psp-success: #28a745;
    --psp-warning: #ffc107;
    --psp-danger: #dc3545;
    --psp-info: #17a2b8;
    --psp-light: #f8f9fa;
    --psp-dark: #343a40;
    --psp-gradient: linear-gradient(135deg, var(--psp-primary) 0%, var(--psp-secondary) 100%);
}

/* Container */
.psp-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Active Challenge */
.psp-active-challenge {
    background: var(--psp-gradient);
    color: white;
    border-radius: 12px;
    padding: 40px;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.psp-active-challenge::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.3; }
}

.psp-challenge-title {
    font-size: 32px;
    margin-bottom: 15px;
    position: relative;
}

.psp-challenge-description {
    font-size: 18px;
    opacity: 0.95;
    margin-bottom: 30px;
    position: relative;
}

.psp-challenge-context {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    position: relative;
}

.psp-challenge-context h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

/* Countdown Timer */
.psp-countdown {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 30px 0;
    position: relative;
}

.psp-countdown-item {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 15px 20px;
    text-align: center;
    backdrop-filter: blur(10px);
    min-width: 80px;
}

.psp-countdown-value {
    font-size: 32px;
    font-weight: bold;
    display: block;
}

.psp-countdown-label {
    font-size: 12px;
    text-transform: uppercase;
    opacity: 0.8;
}

/* Challenge Stats */
.psp-challenge-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
    position: relative;
}

.psp-stat-box {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.psp-stat-value {
    font-size: 28px;
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

.psp-stat-label {
    font-size: 14px;
    opacity: 0.9;
}

/* Submission Form */
.psp-submission-form {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
}

.psp-form-group {
    margin-bottom: 25px;
}

.psp-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--psp-dark);
}

.psp-form-group input[type="text"],
.psp-form-group input[type="url"],
.psp-form-group textarea,
.psp-form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.psp-form-group input:focus,
.psp-form-group textarea:focus,
.psp-form-group select:focus {
    outline: none;
    border-color: var(--psp-primary);
}

.psp-form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.psp-form-help {
    font-size: 14px;
    color: #6b7280;
    margin-top: 5px;
}

/* Image Upload */
.psp-image-upload {
    border: 2px dashed #e5e7eb;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    transition: border-color 0.3s, background-color 0.3s;
    cursor: pointer;
}

.psp-image-upload:hover {
    border-color: var(--psp-primary);
    background-color: #f9fafb;
}

.psp-image-upload.has-image {
    border-style: solid;
    padding: 10px;
}

.psp-image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    margin: 10px auto;
    display: block;
}

/* Buttons */
.psp-btn {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.psp-btn-primary {
    background: var(--psp-gradient);
    color: white;
}

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

.psp-btn-secondary {
    background: white;
    color: var(--psp-primary);
    border: 2px solid var(--psp-primary);
}

.psp-btn-secondary:hover {
    background: var(--psp-primary);
    color: white;
}

.psp-btn-full {
    width: 100%;
}

.psp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Gallery */
.psp-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.psp-gallery-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    width: 270px;
}

.psp-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.psp-gallery-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.psp-gallery-content {
    padding: 20px;
}

.psp-gallery-prompt {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.psp-gallery-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

.psp-gallery-author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.psp-gallery-author img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.psp-gallery-author-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--psp-dark);
}

.psp-gallery-stats {
    display: flex;
    gap: 15px;
}

.psp-gallery-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #6b7280;
}

/* Vote Button */
.psp-vote-btn {
    background: none;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
}

.psp-vote-btn:hover {
    border-color: var(--psp-primary);
    color: var(--psp-primary);
}

.psp-vote-btn.voted {
    background: var(--psp-primary);
    color: white;
    border-color: var(--psp-primary);
}

/* Leaderboard */
.psp-leaderboard {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.psp-leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.psp-leaderboard-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--psp-dark);
}

.psp-period-selector {
    display: flex;
    gap: 10px;
}

.psp-period-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.psp-period-btn:hover,
.psp-period-btn.active {
    background: var(--psp-primary);
    color: white;
    border-color: var(--psp-primary);
}

.psp-leaderboard-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.psp-leaderboard-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.3s;
}

.psp-leaderboard-item:hover {
    background: #f9fafb;
}

.psp-leaderboard-position {
    width: 40px;
    font-size: 20px;
    font-weight: bold;
    color: #6b7280;
}

.psp-leaderboard-item:nth-child(1) .psp-leaderboard-position { color: #ffd700; }
.psp-leaderboard-item:nth-child(2) .psp-leaderboard-position { color: #c0c0c0; }
.psp-leaderboard-item:nth-child(3) .psp-leaderboard-position { color: #cd7f32; }

.psp-leaderboard-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-right: 15px;
}

.psp-leaderboard-info {
    flex: 1;
}

.psp-leaderboard-name {
    font-weight: 600;
    color: var(--psp-dark);
    margin-bottom: 5px;
}

.psp-leaderboard-badges {
    display: flex;
    gap: 5px;
}

.psp-badge {
    font-size: 16px;
}

.psp-leaderboard-points {
    font-size: 20px;
    font-weight: bold;
    color: var(--psp-primary);
}

/* User Profile */
.psp-profile {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.psp-profile-header {
    display: flex;
    align-items: center;
    gap: 30px;
    padding-bottom: 30px;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 30px;
}

.psp-profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--psp-primary);
}

.psp-profile-info h2 {
    margin: 0 0 10px 0;
    font-size: 28px;
    color: var(--psp-dark);
}

.psp-profile-level {
    display: inline-block;
    background: var(--psp-gradient);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
}

.psp-profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.psp-profile-stat {
    text-align: center;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
}

.psp-profile-stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--psp-primary);
    display: block;
    margin-bottom: 5px;
}

.psp-profile-stat-label {
    font-size: 14px;
    color: #6b7280;
}

/* Badges Section */
.psp-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.psp-badge-card {
    background: #f9fafb;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: transform 0.3s;
}

.psp-badge-card:hover {
    transform: translateY(-5px);
}

.psp-badge-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.psp-badge-name {
    font-weight: 600;
    color: var(--psp-dark);
    margin-bottom: 5px;
}

.psp-badge-description {
    font-size: 12px;
    color: #6b7280;
}

/* Loading Spinner */
.psp-loading {
    text-align: center;
    padding: 40px;
}

.psp-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--psp-primary);
    border-radius: 50%;
    animation: psp-spin 1s linear infinite;
}

@keyframes psp-spin {
    to { transform: rotate(360deg); }
}

/* Load More Button */
.psp-load-more {
    text-align: center;
    margin: 40px 0;
}

/* Notices */
.psp-notice {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.psp-notice-success {
    background: #d4edda;
    border-color: var(--psp-success);
    color: #155724;
}

.psp-notice-info {
    background: #d1ecf1;
    border-color: var(--psp-info);
    color: #0c5460;
}

.psp-notice-warning {
    background: #fff3cd;
    border-color: var(--psp-warning);
    color: #856404;
}

.psp-notice-error {
    background: #f8d7da;
    border-color: var(--psp-danger);
    color: #721c24;
}

/* Responsive */
@media (max-width: 768px) {
    .psp-gallery {
        grid-template-columns: 1fr;
    }
    
    .psp-countdown {
        flex-wrap: wrap;
    }
    
    .psp-countdown-item {
        min-width: 60px;
    }
    
    .psp-profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .psp-challenge-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .psp-active-challenge {
        padding: 20px;
    }
    
    .psp-challenge-title {
        font-size: 24px;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.psp-animate-in {
    animation: fadeIn 0.5s ease-out;
}


/* ========================================
   SECCIÓN: Active Challenge - Diseño Mejorado
   ======================================== */

/* Card Principal */
.psp-challenge-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    margin-bottom: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.psp-challenge-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* Header con gradiente */
.psp-challenge-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 24px 32px;
    position: relative;
}

/* Badge de estado */
.psp-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.psp-status-badge.active .psp-status-icon {
    animation: pulse-fire 2s ease-in-out infinite;
}

@keyframes pulse-fire {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Título del reto */
.psp-challenge-header .psp-challenge-title {
    color: white;
    font-size: 28px;
    font-weight: 600;
    margin: 12px 0 0 0;
    line-height: 1.3;
}

/* Descripción */
.psp-challenge-header .psp-challenge-description {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    margin-top: 8px;
    line-height: 1.5;
}

/* Pista integrada en header */
.psp-challenge-hint {
    color: rgba(255, 255, 255, 0.95);
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 14px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.psp-hint-icon {
    font-size: 16px;
    margin-right: 4px;
}

/* Sección de Tiempo */
.psp-time-section {
    padding: 32px;
    background: #fafafa;
    border-bottom: 1px solid #e5e5e7;
}

.psp-time-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.psp-time-label {
    font-size: 14px;
    color: #6e6e73;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.psp-time-icon {
    font-size: 16px;
}

.psp-time-remaining {
    font-size: 13px;
    color: #6e6e73;
}

/* Countdown Mejorado */
.psp-time-section .psp-countdown {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 0;
}

.psp-countdown-item {
    text-align: center;
    background: white;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e5e5e7;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.psp-countdown-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
}

.psp-countdown-value {
    display: block;
    font-size: 32px;
    font-weight: 600;
    color: #1d1d1f;
    line-height: 1;
}

.psp-countdown-label {
    display: block;
    font-size: 11px;
    color: #6e6e73;
    text-transform: uppercase;
    margin-top: 6px;
    letter-spacing: 0.5px;
}

/* Barra de progreso temporal */
.psp-time-progress {
    margin-top: 24px;
}

.psp-progress-bar {
    height: 6px;
    background: #e5e5e7;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.psp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    position: relative;
}

.psp-progress-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%); }
}

.psp-progress-text {
    font-size: 12px;
    color: #6e6e73;
    text-align: center;
    display: block;
}

/* Contexto del Prompt (versión separada) */
.psp-context-section {
    padding: 32px;
    border-bottom: 1px solid #e5e5e7;
    background: white;
}

.psp-context-title {
    font-size: 14px;
    font-weight: 600;
    color: #6e6e73;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.psp-context-icon {
    font-size: 16px;
}

.psp-context-text {
    font-size: 18px;
    color: #1d1d1f;
    line-height: 1.6;
}

/* Estadísticas Mejoradas */
.psp-stats-section {
    padding: 32px;
    border-bottom: 1px solid #e5e5e7;
    background: white;
}

.psp-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.psp-stat-item {
    text-align: center;
    transition: transform 0.2s ease;
}

.psp-stat-item:hover {
    transform: scale(1.05);
}

.psp-stat-item .psp-stat-icon {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}

.psp-stat-item .psp-stat-value {
    display: block;
    font-size: 24px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 4px;
}

.psp-stat-item .psp-stat-label {
    font-size: 12px;
    color: #6e6e73;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Estado del usuario */
.psp-user-status {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 12px;
    padding: 16px 24px;
    margin: 24px 32px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.psp-user-status.participated {
    background: #f0fdf4;
    border-color: #86efac;
}

.psp-user-status.not-participated {
    background: #fef3c7;
    border-color: #fde68a;
}

.psp-user-status-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.psp-user-status-text {
    flex: 1;
    font-size: 14px;
    color: #1d1d1f;
    line-height: 1.4;
}

/* Sección de Acciones */
.psp-actions-section {
    padding: 32px;
    display: flex;
    gap: 16px;
    justify-content: center;
    background: white;
}

/* Botones Mejorados */
.psp-btn {
    padding: 12px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.psp-btn-icon {
    font-size: 18px;
}

.psp-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(102, 126, 234, 0.3);
}

.psp-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(102, 126, 234, 0.4);
    color: white;
    text-decoration: none;
}

.psp-btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.psp-btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.psp-btn-secondary {
    background: white;
    color: #1d1d1f;
    border: 2px solid #e5e5e7;
}

.psp-btn-secondary:hover {
    background: #f5f5f7;
    border-color: #d2d2d7;
    color: #1d1d1f;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .psp-challenge-header {
        padding: 20px;
    }
    
    .psp-challenge-header .psp-challenge-title {
        font-size: 24px;
    }
    
    .psp-time-section,
    .psp-context-section,
    .psp-stats-section {
        padding: 24px 20px;
    }
    
    .psp-time-section .psp-countdown {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .psp-countdown-days,
    .psp-countdown-hours,
    .psp-countdown-minutes,
    .psp-countdown-seconds {
        padding: 12px;
    }
    
    .psp-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .psp-actions-section {
        flex-direction: column;
        padding: 24px 20px;
    }
    
    .psp-btn {
        width: 100%;
        justify-content: center;
    }
    
    .psp-user-status {
        margin: 20px;
    }
}

@media (max-width: 480px) {
    .psp-challenge-header .psp-challenge-title {
        font-size: 20px;
    }
    
    .psp-challenge-header .psp-challenge-description {
        font-size: 14px;
    }
    
    .psp-countdown-value {
        font-size: 28px;
    }
    
    .psp-stat-item .psp-stat-value {
        font-size: 20px;
    }
    
    .psp-time-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Animación de entrada */
.psp-challenge-card {
    animation: fadeInUp 0.6s ease-out;
}

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

/* Estados de carga */
.psp-challenge-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.psp-challenge-card.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}