/**
 * Share Your Story Page Styles
 *
 * @package Magic_Of_Rain
 * @since 1.0.0
 */

/* ===== BUTTON ===== */
.btn-share-story {
    display: inline-block;
    padding: 1.2rem 2.5rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #2B4570, #1a3550);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(43, 69, 112, 0.3);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-share-story:hover {
    background: linear-gradient(135deg, #1a3550, #2B4570);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 30px rgba(43, 69, 112, 0.5);
}

/* ===== MODAL ===== */
.story-form-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999999 !important;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
    pointer-events: auto !important;
}

.modal-content {
    background: white;
    padding: 2rem 2.5rem 2.5rem 2.5rem;
    border-radius: 20px;
    max-width: 700px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-height: 85vh;
    overflow-y: auto;
    z-index: 99999999 !important;
    pointer-events: auto !important;
}

/* Scroll indicator */
.modal-content::after {
    content: '↓ Scroll down ↓';
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, white 50%, transparent);
    text-align: center;
    padding: 1.5rem 0 0.5rem 0;
    font-size: 0.85rem;
    color: #2B4570;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    animation: fadeScrollHint 2s ease-in-out infinite;
}

@keyframes fadeScrollHint {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* Hide scroll indicator when scrolled to bottom */
.modal-content.scrolled-bottom::after {
    display: none;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #2B4570;
}

.modal-content h2 {
    color: #2B4570;
    font-size: 1.6rem;
    margin-bottom: 0.75rem;
    text-align: center;
}

/* ===== SHARE BUTTON SECTION ===== */
.share-button-section {
    text-align: center;
    padding: 0 0 2rem 0;
    margin: 0;
}

/* ===== AGE FILTER ===== */
.stories-filter {
    padding: 0;
    margin: 0;
    text-align: center;
}

.filter-title {
    font-size: 1.8rem;
    color: #2B4570;
    margin: 0 0 1rem 0;
}

.filter-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2B4570;
    background: white;
    border: 2px solid #2B4570;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover,
.filter-btn.active {
    background: #2B4570;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(43, 69, 112, 0.3);
}

/* ===== STORIES GRID ===== */
.stories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
    margin-top: 2rem;
}

.story-card {
    background: rgba(255, 255, 255, 0.9);
    padding: 0;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.story-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Cards without photos need padding at top */
.story-card.no-photos {
    padding-top: 1rem;
}

.story-card.no-photos .story-age-badge {
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.story-card.no-photos .story-content {
    margin-top: 5rem !important;
    padding-top: 0 !important;
}

.story-photos {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0;
    flex-wrap: nowrap;
    overflow: hidden;
}

.story-photo {
    width: 100%;
    height: 450px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.story-photo:hover {
    transform: scale(1.05);
}

/* If only one photo, make it full width */
.story-photos:has(.story-photo:only-child) .story-photo {
    width: 100%;
}

/* If multiple photos, split evenly */
.story-photos:has(.story-photo:nth-child(2)) .story-photo {
    width: calc(50% - 0.25rem);
}

.story-photos:has(.story-photo:nth-child(3)) .story-photo {
    width: calc(33.333% - 0.33rem);
}

.story-age-badge {
    display: block;
    padding: 0.5rem 1rem;
    background: #6B9B5E;
    color: white;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0.5rem 1.5rem 0.5rem auto;
    width: fit-content;
    text-align: right;
}

.story-content {
    color: #333;
    line-height: 1.8;
    margin: 0 2rem 1.5rem 2rem;
    padding-top: 1rem;
}

/* Override for cards with photos - content should be closer to badge */
.story-card:not(.no-photos) .story-content {
    padding-top: 1rem;
}

.story-attribution {
    color: #666;
    font-style: italic;
    font-size: 0.95rem;
    text-align: right;
    margin: 0 2rem;
    padding-bottom: 2rem;
}

.no-stories {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
    font-size: 1.2rem;
}

/* ===== RECAPTCHA CONSENT (GDPR) ===== */
.recaptcha-consent-section {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, rgba(255, 248, 231, 0.9) 0%, rgba(232, 245, 255, 0.9) 100%);
    border-radius: 15px;
    border: 2px solid rgba(224, 122, 95, 0.3);
}

.consent-box {
    text-align: center;
}

.consent-checkbox-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #2B4570;
    margin-bottom: 0.75rem;
}

.consent-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #E07A5F;
}

.consent-text {
    line-height: 1.4;
}

.consent-disclaimer {
    font-size: 0.8rem;
    color: #6B9B5E;
    line-height: 1.5;
    margin: 0;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(107, 155, 94, 0.2);
}

.consent-disclaimer a {
    color: #E07A5F;
    text-decoration: underline;
}

.consent-disclaimer a:hover {
    color: #2B4570;
}

/* When consent is given - minimize the consent section */
.recaptcha-consent-section.consent-given {
    background: rgba(107, 155, 94, 0.1);
    border-color: rgba(107, 155, 94, 0.3);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.recaptcha-consent-section.consent-given .consent-disclaimer {
    display: none;
}

.recaptcha-consent-section.consent-given .consent-checkbox-label {
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* ===== CUSTOM FORM STYLING ===== */
.rain-story-form {
    margin-top: 0.5rem;
}

/* Hide honeypot field from users (bots will fill it) */
#hp_field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.form-intro {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    text-align: center;
    line-height: 1.4;
}

.form-field {
    margin-bottom: 1rem;
}

.form-field label {
    display: block;
    font-weight: 600;
    color: #2B4570;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}

.required-mark {
    color: #DC143C;
    margin-left: 0.25rem;
}

.form-input,
.form-textarea,
.form-select,
.form-input-file {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-input-file {
    padding: 0.6rem;
    cursor: pointer;
}

.form-input-file::-webkit-file-upload-button {
    padding: 0.5rem 1rem;
    background: #2B4570;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    margin-right: 1rem;
}

.form-input-file::-webkit-file-upload-button:hover {
    background: #1a3550;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus,
.form-input-file:focus {
    outline: none;
    border-color: #2B4570;
    box-shadow: 0 0 0 3px rgba(43, 69, 112, 0.1);
}

/* Photo preview */
.photo-preview {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.photo-preview-img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.field-help {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.3rem;
    margin-bottom: 0;
    line-height: 1.3;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.4rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label span {
    color: #333;
    font-size: 0.9rem;
}

.form-actions {
    margin-top: 1.5rem;
    text-align: center;
}

.btn-submit {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #2B4570, #1a3550);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(43, 69, 112, 0.3);
    transition: all 0.3s ease;
}

.btn-submit:hover {
    background: linear-gradient(135deg, #1a3550, #2B4570);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(43, 69, 112, 0.4);
}

.form-notice {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.75rem;
    font-style: italic;
}

.form-messages {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 10px;
    display: none;
}

.form-messages.success {
    display: block;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.form-messages.error {
    display: block;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Page-level error/success messages */
.form-message {
    padding: 1.5rem 2rem;
    border-radius: 10px;
    margin: 2rem 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.form-message.success {
    background: #d4edda;
    border: 2px solid #c3e6cb;
    color: #155724;
}

.form-message.error {
    background: #f8d7da;
    border: 2px solid #f5c6cb;
    color: #721c24;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .modal-content {
        padding: 2rem 1.5rem;
    }

    .filter-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
    }

    .filter-title {
        font-size: 1.5rem;
    }

    .btn-share-story {
        width: 100%;
        max-width: 300px;
    }

    .filter-buttons {
        flex-direction: column;
        align-items: center;
    }

    .filter-btn {
        width: 100%;
        max-width: 300px;
    }

    .stories-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .story-photo {
        height: 200px;
    }
}
