/**
 * PinkCode LearnDash Beautifier - Navigation Buttons Module
 *
 * Professional, modern styling for LearnDash navigation buttons:
 * - Mark Complete Button (green gradient)
 * - Previous Lesson Button (blue gradient)
 * - Next Lesson Button (blue gradient)
 *
 * All three buttons are styled consistently with same size, modern gradients,
 * smooth animations, and aligned in a single responsive row.
 *
 * @package PinkCodeLearnDashBeautifier
 * @version 1.2.0
 * @author Pink Code Queen - Nariman Jafari
 */

/* ==========================================================================
   NAVIGATION BUTTONS CONTAINER
   ========================================================================== */

/**
 * Main container for all three navigation buttons
 * Creates a 3-column grid layout with equal spacing
 * Center column can stack Mark Complete + Back to Course
 */
.learndash-wrapper .ld-content-actions {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr !important;
    gap: 20px !important;
    margin: 40px 0 !important;
    align-items: flex-start !important;
    width: 100% !important;
    max-width: 1200px !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/**
 * Individual button wrapper divs
 * Left & Right wrappers: single button, centered
 * Center wrapper: stacks Mark Complete + Back to Course vertically
 */
.learndash-wrapper .ld-content-action {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    min-height: 46px !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Force all button types to fill their container */
.learndash-wrapper .ld-content-action > a.ld-button,
.learndash-wrapper .ld-content-action > form.sfwd-mark-complete,
.learndash-wrapper .ld-content-action > a.ld-course-step-back {
    width: 100% !important;
    margin: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Mark Complete form styling */
.learndash-wrapper .ld-content-action form.sfwd-mark-complete {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.learndash-wrapper .ld-content-action form.sfwd-mark-complete .learndash_mark_complete_button {
    width: 100% !important;
    margin: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Back to Course link - appears after Mark Complete */
.learndash-wrapper .ld-content-action > a.ld-course-step-back {
    margin-top: 0 !important;
}

/* Empty content actions (for consistent spacing) */
.learndash-wrapper .ld-content-action.ld-empty {
    visibility: hidden !important;
}

/* ==========================================================================
   BUTTON BASE STYLES - MODERN & PROFESSIONAL
   ========================================================================== */

/**
 * Base button styling - applied to Previous/Next buttons
 * Features:
 * - Vibrant blue gradient (College 2b branding)
 * - Rounded corners with soft shadows
 * - Smooth hover animations
 * - Consistent sizing (56px height)
 */
.learndash-wrapper .ld-button {
    /* Layout & Sizing */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    padding: 12px 24px !important;
    height: 46px !important;
    width: 100% !important;
    min-width: 160px !important;
    box-sizing: border-box !important;
    
    /* Visual Design */
    background: linear-gradient(135deg, #0891b2 0%, #06b6d4 50%, #01cfdd 100%) !important;
    border: none !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.25), 
                inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    
    /* Typography */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    letter-spacing: 0.3px !important;
    text-transform: none !important;
    text-decoration: none !important;
    color: #ffffff !important;
    white-space: nowrap !important;
    
    /* Interaction */
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative !important;
    overflow: hidden !important;
}

/* Ensure text and icons are white */
.learndash-wrapper .ld-button .ld-text,
.learndash-wrapper .ld-button span,
.learndash-wrapper .ld-button .ld-icon {
    color: #ffffff !important;
}

/* Expand/Collapse buttons - distinct styling for better visibility on white background */
.learndash-wrapper .ld-expand-button {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%) !important;
    color: #ffffff !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.3) !important;
    transition: all 0.3s ease !important;
}

.learndash-wrapper .ld-expand-button:hover {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%) !important;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.4) !important;
    transform: translateY(-1px) !important;
}

.learndash-wrapper .ld-expand-button .ld-icon,
.learndash-wrapper .ld-expand-button .ld-text {
    color: #ffffff !important;
}

.learndash-wrapper .ld-expand-button.ld-primary-background {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%) !important;
}

/* Hover state - lift and brighten */
.learndash-wrapper .ld-button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(8, 145, 178, 0.35), 
                inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
    background: linear-gradient(135deg, #06829e 0%, #0891b2 50%, #06b6d4 100%) !important;
}

/* Active/pressed state */
.learndash-wrapper .ld-button:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3), 
                inset 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

/* Focus state for accessibility */
.learndash-wrapper .ld-button:focus,
.learndash-wrapper .ld-button:focus-visible {
    outline: 3px solid rgba(6, 182, 212, 0.5) !important;
    outline-offset: 3px !important;
}

/* ==========================================================================
   MARK COMPLETE BUTTON - GREEN GRADIENT
   ========================================================================== */

/**
 * Mark Complete button - distinctive green gradient
 * Positioned in the center column of the grid
 */
.learndash-wrapper .learndash_mark_complete_button,
.learndash-wrapper #learndash_mark_complete_button,
.learndash-wrapper .sfwd-mark-complete .learndash_mark_complete_button {
    /* Layout & Sizing - Same as nav buttons */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    padding: 12px 24px !important;
    height: 46px !important;
    width: 100% !important;
    min-width: 180px !important;
    box-sizing: border-box !important;
    
    /* Visual Design - Green Success Gradient */
    background: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%) !important;
    border: none !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25), 
                inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    
    /* Typography */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    letter-spacing: 0.3px !important;
    text-transform: none !important;
    text-decoration: none !important;
    color: #ffffff !important;
    white-space: nowrap !important;
    
    /* Interaction */
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative !important;
    overflow: hidden !important;
}

/* Mark Complete hover state */
.learndash-wrapper .learndash_mark_complete_button:hover,
.learndash-wrapper #learndash_mark_complete_button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35), 
                inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
    background: linear-gradient(135deg, #059669 0%, #047857 50%, #065f46 100%) !important;
}

/* Mark Complete active state */
.learndash-wrapper .learndash_mark_complete_button:active,
.learndash-wrapper #learndash_mark_complete_button:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3), 
                inset 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

/* Mark Complete focus state */
.learndash-wrapper .learndash_mark_complete_button:focus,
.learndash-wrapper #learndash_mark_complete_button:focus,
.learndash-wrapper .learndash_mark_complete_button:focus-visible,
.learndash-wrapper #learndash_mark_complete_button:focus-visible {
    outline: 3px solid rgba(16, 185, 129, 0.5) !important;
    outline-offset: 3px !important;
}

/* Completed state (already marked complete) - show as completed */
.learndash-wrapper .learndash_mark_complete_button.ld-status-complete,
.learndash-wrapper #learndash_mark_complete_button.ld-status-complete {
    background: linear-gradient(135deg, #6ee7b7 0%, #34d399 100%) !important;
    cursor: default !important;
}

/* Disabled state */
.learndash-wrapper .learndash_mark_complete_button:disabled,
.learndash-wrapper #learndash_mark_complete_button:disabled,
.learndash-wrapper .learndash_mark_complete_button[disabled],
.learndash-wrapper #learndash_mark_complete_button[disabled] {
    background: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%) !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
    transform: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   BACK TO COURSE LINK - SECONDARY STYLE
   ========================================================================== */

/**
 * Back to Course link - styled as secondary button
 * Usually appears in the middle column when Mark Complete is not shown
 */
.learndash-wrapper .ld-course-step-back {
    /* Layout & Sizing */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 12px 20px !important;
    height: 46px !important;
    width: 100% !important;
    min-width: 160px !important;
    box-sizing: border-box !important;
    
    /* Visual Design - Outline Style */
    background: #ffffff !important;
    border: 2px solid #0891b2 !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 6px rgba(8, 145, 178, 0.1) !important;
    
    /* Typography */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    letter-spacing: 0.3px !important;
    text-decoration: none !important;
    color: #0891b2 !important;
    white-space: nowrap !important;
    
    /* Interaction */
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.learndash-wrapper .ld-course-step-back:hover {
    background: #f0f9ff !important;
    border-color: #06829e !important;
    color: #06829e !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.15) !important;
}

.learndash-wrapper .ld-course-step-back:active {
    transform: translateY(0) !important;
    background: #e0f2fe !important;
}

.learndash-wrapper .ld-course-step-back:focus,
.learndash-wrapper .ld-course-step-back:focus-visible {
    outline: 3px solid rgba(6, 182, 212, 0.5) !important;
    outline-offset: 3px !important;
}

/* ==========================================================================
   BUTTON ICONS & TEXT
   ========================================================================== */

/**
 * Icon styling within buttons
 * Includes smooth directional animations on hover
 */
.learndash-wrapper .ld-icon {
    font-size: 18px !important;
    line-height: 1 !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    color: inherit !important;
    flex-shrink: 0 !important;
}

/* Animate Previous arrow on hover */
.learndash-wrapper .ld-button:hover .ld-icon-arrow-left {
    transform: translateX(-4px) !important;
}

/* Animate Next arrow on hover */
.learndash-wrapper .ld-button:hover .ld-icon-arrow-right {
    transform: translateX(4px) !important;
}

/* Button text styling */
.learndash-wrapper .ld-button .ld-text,
.learndash-wrapper .learndash_mark_complete_button .ld-text {
    display: inline-flex !important;
    align-items: center !important;
    line-height: inherit !important;
}

/* ==========================================================================
   RESPONSIVE DESIGN - MOBILE & TABLET
   ========================================================================== */

/**
 * Tablet Layout (768px - 1024px)
 * Keep row layout but reduce spacing
 */
@media (max-width: 1024px) {
    .learndash-wrapper .ld-content-actions {
        gap: 16px !important;
    }
    
    .learndash-wrapper .ld-button,
    .learndash-wrapper .learndash_mark_complete_button {
        padding: 14px 24px !important;
        font-size: 14px !important;
        min-width: 140px !important;
    }
}

/**
 * Mobile Layout (max-width: 768px)
 * Stack buttons vertically for better usability
 */
@media (max-width: 768px) {
    .learndash-wrapper .ld-content-actions {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
        margin: 32px 0 !important;
    }

    .learndash-wrapper .ld-content-action {
        width: 100% !important;
    }

    .learndash-wrapper .ld-button,
    .learndash-wrapper .ld-course-step-back,
    .learndash-wrapper .learndash_mark_complete_button {
        width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
        min-width: 100% !important;
    }

    /* Keep consistent button height on mobile */
    .learndash-wrapper .ld-button,
    .learndash-wrapper .learndash_mark_complete_button {
        padding: 10px 20px !important;
        height: 42px !important;
        font-size: 14px !important;
    }
    
    .learndash-wrapper .ld-course-step-back {
        padding: 10px 18px !important;
        height: 42px !important;
    }
}

/**
 * Small Mobile (max-width: 480px)
 * Allow text wrapping and adjust sizing
 */
@media (max-width: 480px) {
    .learndash-wrapper .ld-button,
    .learndash-wrapper .ld-course-step-back,
    .learndash-wrapper .learndash_mark_complete_button {
        white-space: normal !important;
        min-height: 40px !important;
        height: auto !important;
        padding: 12px 20px !important;
        font-size: 14px !important;
        line-height: 1.5 !important;
    }
    
    .learndash-wrapper .ld-content-actions {
        gap: 12px !important;
        margin: 24px 0 !important;
    }
}

/* ==========================================================================
   ACCESSIBILITY & MOTION PREFERENCES
   ========================================================================== */

/**
 * Respect user's motion preferences
 * Remove animations for users who prefer reduced motion
 */
@media (prefers-reduced-motion: reduce) {
    .learndash-wrapper .ld-button,
    .learndash-wrapper .ld-course-step-back,
    .learndash-wrapper .learndash_mark_complete_button,
    .learndash-wrapper .ld-icon {
        transition: none !important;
        transform: none !important;
    }
    
    .learndash-wrapper .ld-button:hover,
    .learndash-wrapper .learndash_mark_complete_button:hover,
    .learndash-wrapper .ld-course-step-back:hover {
        transform: none !important;
    }
    
    .learndash-wrapper .ld-button:hover .ld-icon-arrow-left,
    .learndash-wrapper .ld-button:hover .ld-icon-arrow-right {
        transform: none !important;
    }
}

/**
 * High contrast mode support
 * Ensure buttons are visible in high contrast themes
 */
@media (prefers-contrast: high) {
    .learndash-wrapper .ld-button,
    .learndash-wrapper .learndash_mark_complete_button {
        border: 2px solid #ffffff !important;
    }
    
    .learndash-wrapper .ld-course-step-back {
        border-width: 3px !important;
    }
}
