/* Recovery Demo Page Styles */

/* Removed global body styles that conflict with main site */
/* Use .recovery-demo-page wrapper if needed, but components should be isolated */

.demo-header {
    text-align: center;
    padding: 40px 20px 20px;
}

.demo-header h1 {
    margin: 0 0 8px;
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #f97316, #fb923c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.demo-header p {
    margin: 0;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.6);
}

.demo-instructions {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.demo-instructions h3 {
    margin: 0 0 12px;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
}

.demo-instructions ol {
    margin: 0;
    padding-left: 20px;
    color: rgba(255, 255, 255, 0.7);
}

.demo-instructions li {
    margin-bottom: 8px;
}

.demo-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.demo-controls-extra {
    text-align: center;
    margin-top: 20px;
}

/* Scoped button styles to avoid conflicts */
.demo-container .btn-secondary,
.demo-instructions .btn-secondary,
.recovery-demo-page .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.demo-container .btn-secondary:hover,
.demo-instructions .btn-secondary:hover,
.recovery-demo-page .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Use specific selector for share button to ensure it overrides defaults if needed but matches main site theme */
.share-actions .btn-primary {
    background: linear-gradient(135deg, #f97316, #fb923c);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.share-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.4);
}

.share-actions {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* Mobile Optimizations */
@media (max-width: 640px) {
    .demo-header {
        padding: 20px 16px 10px;
    }
    
    .demo-header h1 {
        font-size: 24px;
    }
    
    .demo-instructions {
        margin: 16px;
        padding: 16px;
        font-size: 14px;
    }
    
    .demo-container {
        padding: 10px;
    }
}

/* ============================================
   TEMPLATE DOTS UI
   ============================================ */
.template-dots {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
    margin-bottom: 8px;
    padding: 8px 0;
}

.template-dot {
    width: 10px;
    height: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.25);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    position: relative;
}

/* Larger touch target via pseudo-element */
.template-dot::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.template-dot.active {
    background: white;
    transform: scale(1.3);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.share-modal {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    max-width: 360px; /* Reduced from 420px */
    width: 100%;
    overflow: hidden;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    animation: modalSlideUp 0.3s ease-out;
}

.template-selector {
    display: none; /* Hide old selector */
}


/* ============================================
   PREMIUM STORY TEMPLATE STYLES
   Matches iOS AnatomyOnlyStoryTemplate
   ============================================ */

/* Story Template Container - 9:16 aspect ratio */
.story-template {
    position: fixed;
    top: 0;
    left: -9999px;
    width: 540px;
    height: 960px;
    background: #0a0a0f;
    color: white;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
    z-index: -1;
}

/* Premium Background Layers */
.story-background {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.story-gradient {
    position: absolute;
    inset: 0;
    background: 
        linear-gradient(180deg, 
            rgba(15, 23, 42, 1) 0%, 
            rgba(10, 10, 15, 1) 30%,
            rgba(15, 10, 25, 1) 70%,
            rgba(20, 15, 30, 1) 100%
        );
}

.story-noise {
    position: absolute;
    inset: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

.story-sheen {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.04) 0%,
        transparent 40%,
        transparent 60%,
        rgba(255, 255, 255, 0.02) 100%
    );
    pointer-events: none;
}

/* Story Content Layout */
.story-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 50px 30px 40px;
    box-sizing: border-box;
}

/* Title Section */
.story-title-section {
    text-align: center;
    margin-bottom: 24px;
}

.story-title {
    font-size: 36px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.5px;
    color: white;
}

.story-date {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    margin: 8px 0 0;
    letter-spacing: 0.5px;
}

/* Frosted Glass Card */
.story-glass-card {
    flex: 1;
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 28px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px 24px;
    margin-bottom: 24px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

/* Halo Glow Effect */
.story-halo {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 380px;
    height: 500px;
    background: radial-gradient(
        ellipse at center,
        rgba(249, 103, 0, 0.2) 0%,
        rgba(239, 68, 68, 0.1) 30%,
        rgba(139, 92, 246, 0.05) 50%,
        transparent 70%
    );
    border-radius: 50%;
    pointer-events: none;
    filter: blur(40px);
}

/* Anatomy Container */
.story-anatomy-container {
    width: 100%;
    height: 520px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* Cloned Anatomy Styles */
.story-anatomy-container .anatomy-body {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-anatomy-container .muscle-svg {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.story-anatomy-container .silhouette-img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0.35;
}

/* Legend */
.story-legend {
    display: flex;
    gap: 24px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
    justify-content: center;
}

.story-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
}

.story-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.story-dot-red {
    background: linear-gradient(135deg, #FF2C3D, #ef4444);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.story-dot-pink {
    background: linear-gradient(135deg, #E8ABAA, #f472b6);
    box-shadow: 0 0 6px rgba(244, 114, 182, 0.4);
}

.story-dot-gray {
    background: linear-gradient(135deg, #94a3b8, #cbd5e1);
}

/* Brand Footer */
.story-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.story-logo {
    height: 60px;
    width: auto;
    object-fit: contain;
}

.story-brand-text {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 4px;
    color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   TEMPLATE 2: TRANSPARENT OVERLAY
   Matches iOS TransparentAnatomyOnlyStoryTemplate
   For placing on photos in Instagram Stories
   ============================================ */
.story-template-transparent {
    background: transparent !important;
}

.story-content-transparent {
    padding: 60px 30px 120px;
    justify-content: flex-start;
    align-items: center;
    height: 100%;
    gap: 0;
}

.story-anatomy-large {
    width: 100%;
    height: 720px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.story-anatomy-large .anatomy-body {
    transform: scale(1.0);
}

/* Transparent Template Brand - Matches iOS exactly */
.story-brand-transparent {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: -20px;
    padding: 0;
}

.story-logo-transparent {
    height: 90px;
    width: auto;
    object-fit: contain;
}

.story-brand-text-transparent {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 3px;
    color: white;
}

/* ============================================
   TEMPLATE 3: MINIMAL
   Clean, centered, dark background
   ============================================ */
.story-template-minimal {
    background: #050508;
}

.story-background-dark {
    background: #050508;
}

.story-gradient-minimal {
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse at center,
        rgba(20, 20, 30, 1) 0%,
        rgba(5, 5, 8, 1) 100%
    );
}

.story-content-minimal {
    padding: 80px 30px 60px;
    justify-content: center;
    gap: 30px;
}

.story-anatomy-centered {
    width: 100%;
    height: 600px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-legend-minimal {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.story-brand-minimal {
    margin-top: auto;
}

/* ============================================
   SHARED ANATOMY CONTAINER STYLES
   ============================================ */
.story-anatomy-large .anatomy-body,
.story-anatomy-centered .anatomy-body {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-anatomy-large .muscle-svg,
.story-anatomy-centered .muscle-svg {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.story-anatomy-large .silhouette-img,
.story-anatomy-centered .silhouette-img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0.35;
}

/* ============================================
   LEGACY SHARE STYLES (kept for compatibility)
   ============================================ */

.share-template {
    display: none; /* Hidden, using new story-template */
}

/* ============================================
   SHARE OVERLAY MODAL - Premium Design
   ============================================ */
.share-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 1;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.share-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.share-modal {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    max-width: 420px;
    width: 100%;
    overflow: hidden;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    animation: modalSlideUp 0.3s ease-out;
}

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

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.share-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.share-modal-header button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.share-modal-header button:hover,
.share-modal-header button:active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: scale(1.05);
}

.share-modal-body {
    padding: 24px;
    text-align: center;
}

.share-preview-wrapper {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    padding: 12px;
    display: inline-block;
    position: relative;
    overflow: hidden;
}

/* Checkered background for transparent template preview */
.checkered-bg {
    position: absolute;
    inset: 12px;
    border-radius: 12px;
    background-image:
        linear-gradient(45deg, #333 25%, transparent 25%),
        linear-gradient(-45deg, #333 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #333 75%),
        linear-gradient(-45deg, transparent 75%, #333 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #222;
    z-index: 0;
}

#share-preview-image {
    position: relative;
    z-index: 1;
    max-width: 100%;
    max-height: 400px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    transition: opacity 0.2s ease;
}

.share-hint {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin: 16px 0 0;
    line-height: 1.5;
}

.share-modal-footer {
    padding: 20px 24px 24px;
    background: rgba(0, 0, 0, 0.2);
}

/* Share Actions Grid */
.share-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.share-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    min-height: 80px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 13px;
    font-weight: 600;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.share-action-btn svg {
    width: 28px;
    height: 28px;
}

.share-action-btn span {
    display: block;
}

.share-action-btn:active {
    transform: scale(0.95);
    opacity: 0.9;
}

/* Instagram Button */
.share-action-instagram {
    background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
}

.share-action-instagram:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(225, 48, 108, 0.4);
}

/* Download Button */
.share-action-download {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.share-action-download:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

/* Copy Button */
.share-action-copy {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.share-action-copy:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

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

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.share-toast {
    position: fixed;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.share-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.share-toast-success .toast-icon {
    background: #22c55e;
    color: white;
}

.share-toast-error .toast-icon {
    background: #ef4444;
    color: white;
}

.share-toast-warning .toast-icon {
    background: #f59e0b;
    color: white;
}

.share-toast-info .toast-icon {
    background: #3b82f6;
    color: white;
}

.toast-message {
    font-size: 14px;
    font-weight: 500;
    color: white;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .share-overlay {
        padding: 12px;
        align-items: flex-end;
    }

    .share-modal {
        max-width: 100%;
        width: 100%;
        margin: 0;
        border-radius: 24px 24px 0 0;
        max-height: 90vh;
        overflow-y: auto;
    }

    .share-modal-header {
        padding: 16px 16px 12px;
        position: sticky;
        top: 0;
        background: linear-gradient(180deg, #1e293b 0%, #1e293b 100%);
        z-index: 10;
    }

    .share-modal-body {
        padding: 16px;
    }

    .share-preview-wrapper {
        padding: 8px;
    }

    .share-actions-grid {
        gap: 10px;
    }

    .share-action-btn {
        padding: 14px 8px;
        min-height: 72px;
    }

    .share-action-btn svg {
        width: 26px;
        height: 26px;
    }

    .share-action-btn span {
        font-size: 12px;
    }

    #share-preview-image {
        max-height: 320px;
        border-radius: 10px;
    }

    .share-hint {
        font-size: 12px;
        margin: 12px 0 0;
    }

    .share-modal-footer {
        padding: 16px;
        position: sticky;
        bottom: 0;
        background: rgba(0, 0, 0, 0.3);
    }
}
