/**
 * Registrant Journey Plugin Styles
 * Automatically inherits active theme colors
 */

/* CSS Custom Properties that inherit from theme */
.registrant-journey-wrapper {
    /* Primary colors from theme */
    --rj-primary: var(--wp--preset--color--primary, #5ba7ab);
    --rj-secondary: var(--wp--preset--color--secondary, #f7f7f7);
    --rj-accent: var(--wp--preset--color--accent, var(--rj-primary));
    
    /* Text colors from theme */
    --rj-text-primary: var(--wp--preset--color--foreground, #2d3748);
    --rj-text-secondary: var(--wp--preset--color--tertiary, #4a5568);
    --rj-text-light: #718096;
    
    /* Background colors */
    --rj-background: var(--wp--preset--color--background, #ffffff);
    --rj-surface: var(--wp--preset--color--base, #ffffff);
    
    /* Semantic colors */
    --rj-success: #059669;
    --rj-warning: #d97706;
    --rj-error: #dc2626;
    
    /* Success/Warning/Error backgrounds */
    --rj-success-bg: #ecfdf5;
    --rj-warning-bg: #fffbeb;
    --rj-error-bg: #fef2f2;
    
    /* Shadows with theme primary color */
    --rj-shadow: 0 4px 6px -1px rgba(91, 167, 171, 0.1), 0 2px 4px -1px rgba(91, 167, 171, 0.06);
    --rj-shadow-lg: 0 10px 15px -3px rgba(91, 167, 171, 0.15), 0 4px 6px -2px rgba(91, 167, 171, 0.1);
    
    /* Borders */
    --rj-border: #e5e7eb;
    --rj-border-light: #f3f4f6;
}

/* Main container styling - minimal outer styling */
.registrant-journey-wrapper {
    font-family: inherit;
    line-height: 1.6;
    color: var(--rj-text-primary);
    background: transparent;
    padding: 0;
    margin: 0;
    max-width: 100%;
    position: relative;
    border: none;
    box-shadow: none;
}


/* Navigation icons inside story cards */
.rj-nav-icons {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.rj-nav-icon {
    width: 40px;
    height: 40px;
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.rj-nav-icon svg {
    width: 20px;
    height: 20px;
}

.rj-back-icon {
    background: #718096;
    color: white;
}

.rj-back-icon:hover {
    background: #5ba7ab;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(91, 167, 171, 0.4);
}

.rj-restart-icon {
    background: #d97706;
    color: white;
}

.rj-restart-icon:hover {
    background: #b45309;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(217, 119, 6, 0.4);
}

/* Refresh icon in top-right of story cards */
.registrant-journey-wrapper .rj-refresh-icon {
    position: absolute !important;
    top: 20px !important;
    right: 20px !important;
    width: 40px !important;
    height: 40px !important;
    border: 2px solid var(--rj-primary) !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.95) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    color: var(--rj-primary) !important;
    z-index: 10 !important;
    text-decoration: none !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: unset !important;
    max-width: unset !important;
    line-height: 1 !important;
    font-weight: normal !important;
}

.registrant-journey-wrapper .rj-refresh-icon:hover {
    background: var(--rj-primary) !important;
    color: white !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(91, 167, 171, 0.3) !important;
}

.registrant-journey-wrapper .rj-refresh-icon svg {
    width: 20px !important;
    height: 20px !important;
}

/* Story card navigation - positioned on same level as refresh button */
.rj-story-card .rj-header-nav {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.registrant-journey-wrapper .rj-header-nav .rj-icon {
    /* Match .rj-refresh-icon sizing & look exactly */
    width: 40px !important;
    height: 40px !important;
    border: 2px solid var(--rj-primary) !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.95) !important;
    display: flex;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    color: var(--rj-primary) !important;
    z-index: 10 !important;
    text-decoration: none !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: unset !important;
    max-width: unset !important;
    line-height: 1 !important;
    font-weight: 700 !important;
    font-size: 18px !important;
}

.registrant-journey-wrapper .rj-header-nav .rj-icon:hover {
    background: var(--rj-primary) !important;
    color: white !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(91, 167, 171, 0.3) !important;
}


.registrant-journey-wrapper .rj-header-nav .rj-icon:active {
    transform: scale(0.95) !important;
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Mobile touch devices */
    .rj-header-nav .rj-icon,
    .rj-refresh-icon,
    .rj-choice-button,
    .rj-back-button {
        /* Prevent 300ms click delay on mobile */
        touch-action: manipulation;
    }
    
    /* Remove hover effects on touch devices */
    .rj-header-nav .rj-icon:hover,
    .rj-refresh-icon:hover,
    .rj-choice-button:hover,
    .rj-back-button:hover {
        transform: none;
    }
    
    /* Add active/pressed states instead */
    .rj-header-nav .rj-icon:active {
        transform: scale(0.95);
        background: rgba(255, 255, 255, 1);
    }
    
    .rj-refresh-icon:active {
        transform: scale(0.95);
        background: var(--rj-primary);
        color: white;
    }
    
    .rj-choice-button:active {
        transform: scale(0.98);
    }
}

/* Story container */
.rj-story-container {
    position: relative;
    min-height: 500px;
}

/* Story cards */
.rj-story-card {
    background: var(--rj-surface);
    border-radius: 16px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--rj-shadow);
    border: 1px solid var(--rj-border-light);
    transition: all 0.4s ease;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.rj-story-card.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
    position: relative;
}

.rj-story-card:hover {
    box-shadow: var(--rj-shadow-lg);
}

/* Story titles */
.rj-story-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--rj-primary);
    margin: 0 0 1.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--rj-primary);
    text-align: center;
}

/* Story content */
.rj-story-content {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--rj-text-primary);
    margin-bottom: 2rem;
}

.rj-story-content p {
    margin-bottom: 1.25rem;
}

.rj-story-content ul, 
.rj-story-content ol {
    margin: 1.25rem 0;
    padding-left: 2rem;
}

.rj-story-content li {
    margin-bottom: 0.75rem;
}

.rj-highlight {
    font-weight: 600;
    color: var(--rj-primary);
}

/* Choice buttons */
.rj-choice-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.rj-choice-button {
    display: block;
    width: 100%;
    padding: 1.25rem 2rem;
    background: var(--rj-primary);
    color: var(--rj-surface);
    border: none;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.rj-choice-button::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;
}

.rj-choice-button:hover::before {
    left: 100%;
}

.rj-choice-button:hover {
    background: color-mix(in srgb, var(--rj-primary) 85%, black);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(91, 167, 171, 0.4);
}

.rj-choice-button:active {
    transform: translateY(-1px);
}

/* Back buttons */
.rj-back-button {
    padding: 0.875rem 1.5rem;
    background: var(--rj-text-light);
    color: var(--rj-surface);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    margin: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.rj-back-button:hover {
    background: var(--rj-text-secondary);
    transform: translateY(-2px);
}

/* Points section */
.rj-points-section {
    background: var(--rj-warning-bg);
    border: 2px solid var(--rj-warning);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
}

.rj-points-section h3 {
    color: var(--rj-warning);
    font-weight: 700;
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
}

.rj-points-section ul {
    margin: 0;
    padding-left: 1.5rem;
}

/* Success/failure messages */
.rj-success-message {
    background: var(--rj-success-bg);
    border: 2px solid var(--rj-success);
    color: var(--rj-success);
    padding: 2rem;
    border-radius: 12px;
    margin: 2rem 0;
    font-weight: 600;
    font-size: 1.2rem;
    text-align: center;
}

.rj-failure-message {
    background: var(--rj-error-bg);
    border: 2px solid var(--rj-error);
    color: var(--rj-error);
    padding: 2rem;
    border-radius: 12px;
    margin: 2rem 0;
    font-weight: 600;
    font-size: 1.2rem;
    text-align: center;
}

.rj-emoji {
    font-size: 1.5rem;
    margin-right: 0.75rem;
}

/* Navigation note */
.rj-navigation {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--rj-border);
    font-style: italic;
    color: var(--rj-text-secondary);
    font-size: 0.95rem;
}

/* Responsive design */
@media (min-width: 768px) {
    .rj-choice-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .rj-choice-button {
        flex: 1;
        min-width: 250px;
        margin: 0.25rem;
    }
}

@media (max-width: 767px) {

    .rj-story-card {
        padding: 3rem 1.5rem 2rem 1.5rem;
        margin-bottom: 1rem;
    }
    
    /* Header navigation - smaller on mobile and positioned to avoid title overlap */
    .rj-story-card .rj-header-nav {
        top: 15px;
        left: 15px;
        gap: 6px;
    }
    
    .registrant-journey-wrapper .rj-header-nav .rj-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
        border-width: 1px !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    }
    
    /* Refresh icon - smaller on mobile to match navigation buttons */
    .registrant-journey-wrapper .rj-refresh-icon {
        top: 15px !important;
        right: 15px !important;
        width: 32px !important;
        height: 32px !important;
        border-width: 1px !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    }
    
    .registrant-journey-wrapper .rj-refresh-icon svg {
        width: 16px !important;
        height: 16px !important;
    }
    
    /* Choice buttons - better mobile spacing */
    .rj-choice-buttons {
        gap: 0.75rem;
    }
    
    .rj-choice-button {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 48px; /* Better touch target */
    }
    
    .rj-back-button {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
        min-height: 44px; /* Better touch target */
    }
}

/* Animation classes for smooth transitions */
.rj-fade-in {
    animation: rjFadeIn 0.6s ease-out forwards;
}

.rj-fade-out {
    animation: rjFadeOut 0.3s ease-in forwards;
}

@keyframes rjFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rjFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Loading state */
.rj-loading {
    pointer-events: none;
}

.rj-loading .rj-choice-button {
    opacity: 0.7;
    cursor: wait;
}