/* Report Loading Screen
   Professional loader with cycling framework messages
   Uses global 7ED styling
*/

.report-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* When in iframe, use absolute positioning */
.in-iframe .report-loader-overlay {
    position: absolute;
}

/* ============================================
   IFRAME LOADER - Full Frame Design
   Fills 80%+ of the viewport, animated network
   ============================================ */

/* Hide the default card container in iframe */
.in-iframe .report-loader {
    display: none;
}

/* Full-frame loader container */
.full-frame-loader {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    box-sizing: border-box;
}

/* Main network visualization - large */
.framework-network-large {
    position: relative;
    width: min(420px, 85vw);
    height: min(420px, 85vw);
    margin-bottom: 1.5rem;
}

/* Center hub with 7ed */
.network-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, #2EB8B8 0%, #1a9a9a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(46, 184, 184, 0.4);
    z-index: 20;
}

.network-center-text {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

/* SVG for connections */
.network-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.network-connection {
    stroke: #e2e8f0;
    stroke-width: 2;
    fill: none;
    transition: all 0.5s ease;
}

.network-connection.active {
    stroke: #2EB8B8;
    stroke-width: 3;
    filter: drop-shadow(0 0 4px rgba(46, 184, 184, 0.6));
}

.network-connection.complete {
    stroke: #2EB8B8;
    stroke-width: 2;
}

/* Outer ring - 7 core frameworks */
.framework-node-outer {
    position: absolute;
    width: 64px;
    height: 64px;
    background: #ffffff;
    border: 3px solid #e2e8f0;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.5s ease;
    opacity: 0.5;
    z-index: 15;
}

.framework-node-outer.active {
    background: linear-gradient(135deg, #E0F4F4 0%, #c8f0f0 100%);
    border-color: #2EB8B8;
    opacity: 1;
    transform: scale(1.15);
    box-shadow: 0 6px 24px rgba(46, 184, 184, 0.4);
}

.framework-node-outer.complete {
    background: linear-gradient(135deg, #2EB8B8 0%, #1a9a9a 100%);
    border-color: #2EB8B8;
    opacity: 1;
}

.framework-node-outer.complete .node-icon,
.framework-node-outer.complete .node-label {
    color: white;
}

.node-icon {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.node-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #64748b;
}

/* Inner ring - secondary/survey-specific frameworks */
.framework-node-inner {
    position: absolute;
    width: 48px;
    height: 48px;
    background: #fefefe;
    border: 2px solid #e2e8f0;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.5s ease;
    opacity: 0.4;
    z-index: 10;
}

.framework-node-inner.active {
    background: linear-gradient(135deg, #fef9e7 0%, #fdf6e3 100%);
    border-color: #f59e0b;
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.framework-node-inner.complete {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-color: #f59e0b;
    opacity: 1;
}

.framework-node-inner.complete .node-icon,
.framework-node-inner.complete .node-label {
    color: white;
}

.framework-node-inner .node-icon {
    font-size: 1rem;
}

.framework-node-inner .node-label {
    font-size: 0.5rem;
}

/* Coffee animation container */
.coffee-animation {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 60px;
    height: 70px;
    z-index: 25;
}

.coffee-cup {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2.5rem;
}

.coffee-pour {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 0;
    background: linear-gradient(180deg, #8B4513 0%, #D2691E 100%);
    border-radius: 4px;
    animation: pourCoffee 3s ease-in-out infinite;
}

@keyframes pourCoffee {
    0%, 100% { height: 0; opacity: 0; top: 5px; }
    10% { height: 0; opacity: 1; top: 5px; }
    50% { height: 35px; opacity: 1; top: 5px; }
    60% { height: 35px; opacity: 1; top: 5px; }
    90% { height: 0; opacity: 0; top: 40px; }
}

.coffee-steam {
    position: absolute;
    bottom: 45px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 3px;
}

.steam-line {
    width: 2px;
    height: 12px;
    background: rgba(200, 200, 200, 0.6);
    border-radius: 2px;
    animation: steamRise 2s ease-in-out infinite;
}

.steam-line:nth-child(2) { animation-delay: 0.3s; }
.steam-line:nth-child(3) { animation-delay: 0.6s; }

@keyframes steamRise {
    0%, 100% { opacity: 0; transform: translateY(0) scaleY(1); }
    50% { opacity: 0.7; transform: translateY(-8px) scaleY(1.2); }
}

/* Status section */
.loader-status {
    text-align: center;
    margin-bottom: 1rem;
}

.loader-status-main {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a2f4a;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.loader-status-icon {
    font-size: 1.2rem;
    animation: iconPulse 1.5s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.loader-status-sub {
    font-size: 0.85rem;
    color: #64748b;
}

.loader-coffee-msg {
    font-size: 0.8rem;
    color: #2EB8B8;
    font-style: italic;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: #E0F4F4;
    border-radius: 20px;
    display: inline-block;
}

/* Educational tip - bottom of frame */
.loader-tip-section {
    width: 100%;
    max-width: 500px;
    background: white;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #2EB8B8;
    border-radius: 0 12px 12px 0;
    padding: 1rem 1.25rem;
    text-align: left;
}

.loader-tip-label {
    font-size: 0.7rem;
    color: #2EB8B8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.35rem;
}

.loader-tip-text {
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.5;
}

/* Cancel button */
.loader-cancel-btn {
    margin-top: 1rem;
    padding: 0.5rem 1.5rem;
    font-size: 0.85rem;
    border-radius: 8px;
    background: transparent;
    border: 1px solid #e2e8f0;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.loader-cancel-btn:hover {
    background: #f9fafb;
    border-color: #cbd5e1;
    color: #475569;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .framework-network-large {
        width: min(320px, 90vw);
        height: min(320px, 90vw);
    }
    
    .network-center {
        width: 70px;
        height: 70px;
    }
    
    .network-center-text {
        font-size: 1.3rem;
    }
    
    .framework-node-outer {
        width: 52px;
        height: 52px;
    }
    
    .framework-node-outer .node-icon {
        font-size: 1.1rem;
    }
    
    .framework-node-outer .node-label {
        font-size: 0.5rem;
    }
    
    .framework-node-inner {
        width: 40px;
        height: 40px;
    }
    
    .coffee-animation {
        width: 50px;
        height: 60px;
    }
    
    .coffee-cup {
        font-size: 2rem;
    }
}

.report-loader {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 60px rgba(0,0,0,0.12);
    padding: 2rem 2.5rem;
    width: 90%;
    max-width: 500px;
    text-align: center;
}

.report-loader-header {
    margin-bottom: 2rem;
}

.report-loader-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a2f4a;
    margin: 0 0 0.5rem 0;
}

.report-loader-subtitle {
    font-size: 0.95rem;
    color: #64748b;
    margin: 0;
}

.report-loader-wait-message {
    font-size: 0.9rem;
    color: #2EB8B8;
    margin: 1rem 0 0 0;
    font-style: italic;
    padding: 0.75rem 1rem;
    background: #E0F4F4;
    border-radius: 8px;
    border-left: 3px solid #2EB8B8;
}

/* Progress Bar */
.report-loader-progress {
    background: #e2e8f0;
    border-radius: 8px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.report-loader-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #2EB8B8 0%, #d4af37 50%, #2EB8B8 100%);
    background-size: 200% 100%;
    border-radius: 8px;
    width: 0%;
    transition: width 0.5s ease;
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Current Action Display */
.report-loader-action {
    background: linear-gradient(135deg, #fef9e7 0%, #fdf6e3 100%);
    border-left: 4px solid #2EB8B8;
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.report-loader-action-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: #92400e;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.report-loader-action-icon {
    font-size: 1.3rem;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

/* Stage Indicators */
.report-loader-stages {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.report-loader-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.4;
    transition: all 0.3s ease;
}

.report-loader-stage.active {
    opacity: 1;
}

.report-loader-stage.complete {
    opacity: 1;
}

.report-loader-stage-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    color: #64748b;
    transition: all 0.3s ease;
}

.report-loader-stage.active .report-loader-stage-icon {
    background: #2EB8B8;
    color: white;
    box-shadow: 0 0 0 4px rgba(201, 162, 39, 0.2);
}

.report-loader-stage.complete .report-loader-stage-icon {
    background: #16a34a;
    color: white;
}

.report-loader-stage-label {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
}

.report-loader-stage.active .report-loader-stage-label {
    color: #1a2f4a;
}

.report-loader-stage.complete .report-loader-stage-label {
    color: #16a34a;
}

/* Footer */
.report-loader-footer {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 1rem;
}

/* Educational Tip */
.report-loader-tip {
    background: #ffffff;
    border-left: 4px solid #2EB8B8;
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.report-loader-tip-label {
    font-size: 0.75rem;
    color: #2EB8B8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
}

.report-loader-tip-text {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
    transition: opacity 0.3s ease;
}

/* Cancel Button */
.report-loader-cancel {
    margin-top: 0.5rem;
    padding: 0.6rem 1.5rem;
    background: transparent;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #64748b;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.report-loader-cancel:hover {
    background: #f9fafb;
    border-color: #94a3b8;
    color: #475569;
}

/* Mobile */
@media (max-width: 600px) {
    .report-loader {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }
    
    .report-loader-title {
        font-size: 1.25rem;
    }
    
    .report-loader-stages {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .report-loader-action-text {
        font-size: 1rem;
    }
}

/* ============================================
   INLINE LOADER - Compact version for cards
   ============================================ */

.inline-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem 2rem;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.inline-loader-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #2EB8B8;
    border-radius: 50%;
    animation: inline-spin 1s linear infinite;
    flex-shrink: 0;
}

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

.inline-loader-content {
    text-align: left;
}

.inline-loader-title {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 600;
    color: #1a2f4a;
    margin-bottom: 0.25rem;
}

.inline-loader-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #64748b;
}

.inline-loader-icon {
    font-size: 1rem;
}

.inline-loader-text {
    transition: opacity 0.2s ease;
}

/* Small variant for tight spaces */
.inline-loader.small {
    padding: 1rem 1.5rem;
    gap: 0.75rem;
}

.inline-loader.small .inline-loader-spinner {
    width: 24px;
    height: 24px;
    border-width: 2px;
}

.inline-loader.small .inline-loader-title {
    font-size: 0.9rem;
}

.inline-loader.small .inline-loader-message {
    font-size: 0.8rem;
}

/* Minimal variant - just message */
.inline-loader.minimal {
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    justify-content: flex-start;
}

.inline-loader.minimal .inline-loader-spinner {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.inline-loader.minimal .inline-loader-title {
    display: none;
}

.inline-loader.minimal .inline-loader-message {
    font-size: 0.85rem;
}

/* ============================================
   COMPACT LOADER - Card overlay for inline use
   Used in: Studio, Progress, Synthesis, Admin
   ============================================ */

.compact-loader-overlay {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    padding: 2rem;
}

.compact-loader-fullpage {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.compact-loader {
    background: white;
    border-radius: 16px;
    padding: 1.75rem 2rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    text-align: center;
}

.compact-loader-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: #1a2f4a;
    margin: 0 0 1rem 0;
}

/* Compact Coffee Message */
.compact-loader-coffee {
    background: linear-gradient(135deg, #FFF8E7 0%, #FEF3D4 100%);
    border: 1px solid #F5DEB3;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.compact-loader-coffee span {
    color: #8B6914;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Compact Progress Bar */
.compact-loader-progress {
    background: #ffffff;
    border-radius: 6px;
    height: 6px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.compact-loader-progress-bar {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #2EB8B8, #3AACB8, #2EB8B8);
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
    width: 25%;
    transition: width 0.5s ease;
}

/* Compact Action Display */
.compact-loader-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    background: linear-gradient(135deg, #E8F8F8 0%, #E0F4F4 100%);
    border-radius: 10px;
}

.compact-loader-action-icon {
    font-size: 1.2rem;
    animation: pulse 1.5s ease-in-out infinite;
}

.compact-loader-action-text {
    font-size: 0.95rem;
    color: #1a6b6b;
    font-weight: 500;
}

/* Compact Educational Tip */
.compact-loader-tip {
    background: #ffffff;
    border-left: 3px solid #2EB8B8;
    border-radius: 0 8px 8px 0;
    padding: 0.8rem 1rem;
    text-align: left;
    margin-bottom: 0.8rem;
}

.compact-loader-tip-label {
    font-size: 0.65rem;
    color: #2EB8B8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.2rem;
}

.compact-loader-tip-text {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.4;
    transition: opacity 0.3s ease;
}

/* Compact Time Estimate */
.compact-loader-time {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 0.8rem;
}

/* Compact Cancel Button */
.compact-loader-cancel {
    padding: 0.5rem 1.2rem;
    background: transparent;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #64748b;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.compact-loader-cancel:hover {
    background: #f9fafb;
    border-color: #94a3b8;
    color: #475569;
}

/* Mobile adjustments for compact loader */
@media (max-width: 480px) {
    .compact-loader {
        padding: 1.25rem 1.5rem;
        margin: 0.5rem;
    }
    
    .compact-loader-title {
        font-size: 1.1rem;
    }
    
    .compact-loader-coffee span {
        font-size: 0.85rem;
    }
    
    .compact-loader-tip-text {
        font-size: 0.8rem;
    }
}
