/**
 * 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 */
.registrant-journey-wrapper {
    font-family: inherit;
    line-height: 1.6;
    color: var(--rj-text-primary);
    background: transparent;
    padding: 0;
    margin: 0 auto;
    max-width: 900px;
    position: relative;
}

/* Header card */
.rj-header-card {
    background: var(--rj-surface);
    padding: 2.5rem;
    margin-bottom: 0;
    text-align: center;
    box-shadow: var(--rj-shadow);
    position: relative;
}

.rj-main-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--rj-primary);
    margin: 0 0 1rem 0;
    text-decoration: underline;
    text-decoration-color: var(--rj-primary);
    text-underline-offset: 6px;
    text-decoration-thickness: 3px;
}

.rj-subtitle {
    font-size: 1.125rem;
    color: var(--rj-text-secondary);
    margin-bottom: 1.5rem;
}

.rj-org-link {
    display: inline-block;
    color: var(--rj-primary);
    text-decoration: none;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--rj-primary);
    border-radius: 8px;
    transition: all 0.3s ease;
    background: transparent;
}

.rj-org-link:hover {
    background: var(--rj-primary);
    color: var(--rj-surface);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 167, 171, 0.3);
}

/* 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;
}

/* Header navigation
.rj-header-nav {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 12px;
    z-index: 100;
}
 */
.registrant-journey-wrapper .rj-header-nav .rj-icon { 
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(0, 0, 0, 0.1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    color: #333 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15) !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-header-nav .rj-icon:hover {
    background: rgba(255, 255, 255, 1) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
}

.registrant-journey-wrapper .rj-header-nav .rj-icon.disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

.registrant-journey-wrapper .rj-header-nav .rj-icon:disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !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: 0 0 16px 16px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--rj-shadow);
    border: 1px solid var(--rj-border-light);
    border-top: none;
    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);
}

/* 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;
    }

    .registrant-journey-wrapper {
        padding: 0;
    }
}

@media (max-width: 767px) {
    .rj-main-title {
        font-size: 1.875rem;
    }

    .rj-header-card {
        padding: 2rem 1.5rem;
    }

    .rj-story-card {
        padding: 2rem 1.5rem;
        margin-top: 1rem;
    }

    .registrant-journey-wrapper {
        padding: 0;
    }
    
    /* Header navigation - smaller on mobile
    .rj-header-nav {
        bottom: 15px;
        left: 15px;
        gap: 10px;
    } */
    
    .registrant-journey-wrapper .rj-header-nav .rj-icon {
        width: 42px !important;
        height: 42px !important;
        font-size: 18px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    }
    
    /* Refresh icon - smaller on mobile */
    .registrant-journey-wrapper .rj-refresh-icon {
        top: 15px !important;
        right: 15px !important;
        width: 36px !important;
        height: 36px !important;
        border-width: 1px !important;
    }
    
    .registrant-journey-wrapper .rj-refresh-icon svg {
        width: 18px !important;
        height: 18px !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;
}
/*added by khaled*/
/* Make NEXT/PREV look exactly like the refresh button */
.registrant-journey-wrapper .rj-header-nav .rj-icon {
  /* Match .rj-refresh-icon sizing & look */
  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;

  /* we’ll draw the icon via ::before, so hide original glyph */
  font-size: 0 !important;
  text-decoration: none !important;
  margin: 0 !important;
  min-width: unset !important;
  max-width: unset !important;
  line-height: 1 !important;
  font-weight: normal !important;
}

/* Hover/active to match refresh */
.registrant-journey-wrapper .rj-header-nav .rj-icon:hover {
  background: var(--rj-primary) !important;
  color: #fff !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
  border-color: var(--rj-primary) !important;
}
.registrant-journey-wrapper .rj-header-nav .rj-icon:active {
  transform: scale(0.95) !important;
}

/* Replace ↶ / ↷ with simple ← / → arrows */
.registrant-journey-wrapper .rj-header-nav .rj-icon[data-action="undo"]::before {
  content: '←';
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}
.registrant-journey-wrapper .rj-header-nav .rj-icon[data-action="redo"]::before {
  content: '→';
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

/* Do NOT show next/previous at the start (they are disabled initially) */
.rj-header-nav .rj-icon.disabled {
  display: none !important;
}

/* Keep good contrast when focused (keyboard users) */
.registrant-journey-wrapper .rj-header-nav .rj-icon:focus {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.25), 0 2px 8px rgba(0,0,0,0.1) !important; /* uses success-ish green glow */
}
/* 1) Turn each story card into a header row (top) + content (below) */
.rj-story-card {
  display: grid;
  grid-template-columns: auto 1fr auto; /* left buttons | centered title | right refresh */
  grid-auto-rows: auto;
  align-items: center;
  row-gap: 0.75rem; /* space between header row and the body text */
}

/* 2) By default, every child spans full width (content goes to next row) */
.rj-story-card > * {
  grid-column: 1 / -1;
}

/* 3) Place the three header pieces on the same row */
.rj-story-card .rj-header-nav {
  grid-column: 1;            /* left */
  justify-self: start;
  display: flex;
  gap: 10px;
}

.rj-story-card .rj-story-title,
.rj-story-card .rj-main-title {
  grid-column: 2;            /* center */
  justify-self: center;
  text-align: center;
  margin: 0;                 /* keep the underline tight to the row */
}

.rj-story-card .rj-refresh-icon {
  grid-column: 3;            /* right */
  justify-self: end;
}

/* 4) Keep Prev/Next hidden when disabled (your rule already exists; keeping for clarity) */
.rj-header-nav .rj-icon.disabled { display: none !important; }

/* 5) Optional: tighten vertical rhythm on small screens */
@media (max-width: 640px) {
  .rj-story-card { row-gap: 0.5rem; }
}
/* Align top bar on story cards: [← →] | Title | [⟳] */
.rj-story-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  row-gap: 1.25rem;
  padding-top: 3.5rem; /* adds space for buttons and title */
}

/* Left: Prev/Next */
.rj-story-card .rj-header-nav {
  grid-column: 1;
  justify-self: start;
  display: flex;
  gap: 10px;
  position: relative;
  top: 0;
}

/* Center: Title */
.rj-story-card .rj-story-title {
  grid-column: 2;
  justify-self: center;
  text-align: center;
  margin: 0;
  padding-bottom: 0.75rem;
  border-bottom: 3px solid var(--rj-primary);
}

/* Right: Refresh */
.rj-story-card .rj-refresh-icon {
  grid-column: 3;
  justify-self: end;
  position: relative !important;
  top: 0 !important;
  right: 0 !important;
}

/* Hide disabled navs at start */
.rj-story-card .rj-header-nav .rj-icon.disabled {
  display: none !important;
}
