
/* 
   FOKUS PRO // EXERCISES MODULE
   Grid & Ultimate Detail Modal v5.5
*/

/* --- GRID LAYOUT --- */
.exercises-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding-bottom: 80px; /* Space for Nav */
}

/* --- CARD DESIGN (Liste) --- */
.ex-tactical-card {
    background: rgba(13, 22, 40, 0.8);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.ex-tactical-card:hover {
    transform: translateY(-5px);
    border-color: var(--c-primary);
    box-shadow: 0 10px 30px -10px rgba(16, 185, 129, 0.2);
}

.ex-tactical-card.completed {
    border-color: var(--c-primary);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, rgba(13, 22, 40, 0.9) 100%);
}

/* LOCKED STATE STYLES */
.ex-tactical-card.locked {
    filter: grayscale(0.8);
    opacity: 0.8;
    border-color: rgba(255,255,255,0.05);
}
.ex-tactical-card.locked:hover {
    transform: none;
    border-color: var(--c-danger);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}
.ex-lock-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    z-index: 10;
    flex-direction: column;
    gap: 10px;
}
.ex-lock-icon {
    font-size: 3rem; color: var(--c-text-sec);
    text-shadow: 0 0 20px black;
}
.ex-lock-price {
    background: rgba(0,0,0,0.8); border: 1px solid #f59e0b;
    color: #f59e0b; padding: 6px 12px; border-radius: 20px;
    font-family: var(--font-tech); font-weight: 800; font-size: 0.9rem;
}

.ex-card-image-area {
    width: 100%; height: 160px;
    background-color: #000;
    background-position: center; background-size: cover; background-repeat: no-repeat;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    position: relative;
}

.ex-lvl-badge-card {
    position: absolute; top: 10px; right: 10px;
    background: rgba(0,0,0,0.8); border: 1px solid var(--c-primary);
    color: var(--c-primary); font-family: var(--font-tech);
    font-size: 0.7rem; font-weight: 800; padding: 4px 8px;
    border-radius: 4px; backdrop-filter: blur(4px);
}

.ex-card-top {
    padding: 12px 15px; border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex; justify-content: space-between; align-items: center;
}

.ex-cat-badge {
    font-size: 0.6rem; font-weight: 800; letter-spacing: 1px;
    text-transform: uppercase; padding: 4px 8px; border-radius: 4px;
    background: rgba(255,255,255,0.05); color: var(--c-text-sec);
}
.cat-technik { color: #60a5fa; border-color: rgba(96, 165, 250, 0.3); background: rgba(96, 165, 250, 0.1); }
.cat-lage { color: #34d399; border-color: rgba(52, 211, 153, 0.3); background: rgba(52, 211, 153, 0.1); }
.cat-potten { color: #a78bfa; border-color: rgba(167, 139, 250, 0.3); background: rgba(167, 139, 250, 0.1); }

.ex-xp-pill {
    font-family: var(--font-tech); font-size: 0.75rem; color: var(--c-primary); font-weight: 700;
}

.ex-card-content { padding: 15px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.ex-card-title { font-size: 1.1rem; font-weight: 700; color: white; line-height: 1.3; }
.ex-card-desc {
    font-size: 0.8rem; color: var(--c-text-sec);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; line-height: 1.5;
}

/* KEY MISSION BADGE */
.ex-key-mission-badge {
    display: inline-block; font-size: 0.6rem; font-weight: 900; 
    background: #f59e0b; color: black; padding: 2px 6px; border-radius: 4px;
    margin-right: 5px; vertical-align: middle;
}

/* --- PIKTOGRAMME (BACKLIGHT/GLOW STYLE) --- */
.ex-pikto-row { display: flex; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }

.pikto-icon {
    width: 28px; height: 28px;
    /* Use background-image to keep original pixels */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: transparent !important; /* No solid fill */
    
    /* Disable Masking Explicitly */
    -webkit-mask: none !important;
    mask: none !important;
    
    transition: 0.3s;
    display: block;
}

/* POSITIVE (GREEN GLOW BEHIND) */
.pikto-icon.pos {
    filter: drop-shadow(0 0 3px #10b981) drop-shadow(0 0 6px #10b981);
}

/* NEGATIVE (RED GLOW BEHIND) */
.pikto-icon.neg {
    filter: drop-shadow(0 0 3px #ef4444) drop-shadow(0 0 6px #ef4444);
}


.ex-card-footer { padding: 15px; background: rgba(0,0,0,0.2); }
.btn-open-detail {
    width: 100%; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    color: white; padding: 12px; border-radius: 8px; font-size: 0.8rem; font-weight: 700;
    cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-open-detail:hover { background: rgba(255,255,255,0.1); border-color: white; }
.btn-open-detail.action-finish { background: rgba(16, 185, 129, 0.15); border-color: var(--c-primary); color: var(--c-primary); }
.btn-open-detail.action-finish:hover { background: var(--c-primary); color: black; }

/* UNLOCK BUTTON */
.btn-unlock-ex {
    width: 100%; background: rgba(245, 158, 11, 0.1); border: 1px solid #f59e0b;
    color: #f59e0b; padding: 12px; border-radius: 8px; font-size: 0.8rem; font-weight: 700;
    cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px;
    z-index: 20; position: relative;
}
.btn-unlock-ex:hover { background: #f59e0b; color: black; box-shadow: 0 0 15px #f59e0b; }


/* --- ULTIMATE DETAIL MODAL v5.0 --- */

/* Fix Scrolling Issues: The overlay itself is fixed and doesn't scroll */
.ex-modal-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,0.9); backdrop-filter: blur(10px);
    display: flex; align-items: center; justify-content: center;
    padding: 10px; /* Reduced padding on mobile */
    animation: fadeIn 0.2s ease-out;
    overflow: hidden; /* CRITICAL: Prevent body scroll leak */
}

/* The Window */
.ex-modal-window {
    width: 100%; max-width: 500px;
    /* Use dvh for better mobile browser support */
    height: 85dvh; 
    max-height: 800px;
    background: #020617; 
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 16px;
    display: flex; flex-direction: column;
    overflow: hidden; /* Window frame static */
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    position: relative;
}

/* 1. HEADER */
.exm-header {
    flex-shrink: 0;
    padding: 15px 20px;
    background: rgba(11, 17, 32, 0.95);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex; justify-content: space-between; align-items: center;
    z-index: 10;
}
.exm-title-block { display: flex; flex-direction: column; overflow: hidden; }
.exm-title { 
    font-size: 1rem; font-weight: 800; color: white; 
    text-transform: uppercase; white-space: nowrap; 
    overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.5px;
}
.exm-subtitle { font-size: 0.65rem; color: var(--c-primary); font-family: var(--font-tech); letter-spacing: 1px; }

.exm-close { 
    width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); 
    color: var(--c-text-sec); display: flex; align-items: center; justify-content: center; 
    cursor: pointer; transition: 0.2s;
}
.exm-close:hover { background: var(--c-danger); color: white; border-color: var(--c-danger); }

/* 2. SCROLL CONTENT AREA */
.exm-scroll-content {
    flex: 1; 
    overflow-y: auto; /* THIS is the only thing that scrolls */
    overflow-x: hidden;
    position: relative; 
    display: flex; flex-direction: column;
    background: #0b1120;
    -webkit-overflow-scrolling: touch;
}

/* 3. HERO IMAGE (Interactive) */
.exm-hero-wrapper {
    position: relative;
    width: 100%;
    height: 220px;
    flex-shrink: 0;
    cursor: zoom-in; /* Indicates clickability */
    overflow: hidden;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.exm-hero-wrapper:hover .exm-hero-img { transform: scale(1.05); }

/* Blurred Backdrop */
.exm-hero-blur {
    position: absolute; inset: 0;
    background-size: cover; background-position: center;
    filter: blur(15px) brightness(0.4);
    transform: scale(1.1);
    z-index: 1;
}
/* Main Image (Contained) */
.exm-hero-img {
    position: relative; z-index: 2;
    width: 100%; height: 100%;
    background-size: contain; background-repeat: no-repeat; background-position: center;
    transition: transform 0.5s ease;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.5));
}
.exm-zoom-hint {
    position: absolute; top: 10px; right: 10px; z-index: 3;
    background: rgba(0,0,0,0.6); padding: 4px 8px; border-radius: 4px;
    color: white; font-size: 0.7rem; pointer-events: none;
    border: 1px solid rgba(255,255,255,0.2); backdrop-filter: blur(4px);
}

/* LIGHTBOX OVERLAY */
.lightbox-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.95);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.3s ease-out;
    cursor: zoom-out;
}
.lightbox-img {
    max-width: 95%; max-height: 95%;
    object-fit: contain;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
}

/* 4. PIKTOGRAM GRID (UPDATED) */
.exm-pikto-bar {
    padding: 15px 20px;
    background: #0f172a;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex; gap: 15px;
    flex-wrap: wrap; 
    justify-content: center; 
}

/* Large Modal Pikto */
.pikto-icon-large {
    width: 54px; height: 54px;
    
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: transparent !important;
    
    /* Disable Masking Explicitly */
    -webkit-mask: none !important;
    mask: none !important;
    
    display: block;
    transition: 0.2s;
}
/* USER VIEW POSITIVE (GREEN) */
.pikto-icon-large.pos {
    filter: drop-shadow(0 0 5px #10b981) drop-shadow(0 0 10px #10b981);
}
/* USER VIEW NEGATIVE (RED) */
.pikto-icon-large.neg {
    filter: drop-shadow(0 0 5px #ef4444) drop-shadow(0 0 10px #ef4444);
}


/* 5. STATS GRID */
.exm-hud-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    padding: 20px 20px 10px 20px;
}
.exm-hud-box {
    background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0) 100%);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px; padding: 12px;
    display: flex; flex-direction: column; justify-content: center;
}
.hud-label { font-size: 0.6rem; color: #64748b; font-weight: 700; letter-spacing: 1px; margin-bottom: 4px; text-transform: uppercase; }
.hud-val { font-family: var(--font-tech); font-size: 1.1rem; color: white; font-weight: 800; }
.hud-accent { color: var(--c-accent-bright); }

/* 6. CONTENT TABS & TEXT */
.exm-text-section {
    padding: 10px 20px 30px 20px;
}
.exm-tab-switch {
    display: flex; gap: 20px; margin-bottom: 15px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.exm-tab-btn {
    background: none; border: none; padding: 10px 0;
    color: var(--c-text-sec); font-weight: 700; font-size: 0.8rem;
    cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.exm-tab-btn.active { color: var(--c-primary); border-color: var(--c-primary); }

.exm-text-content {
    font-size: 0.95rem; line-height: 1.6; color: #cbd5e1;
    white-space: pre-wrap;
    padding-bottom: 10px; /* Text padding */
}

/* 7. INPUT AREA (Fixed Bottom - High Tech) */
.exm-footer {
    background: #050a14;
    border-top: 1px solid rgba(59, 130, 246, 0.3);
    padding: 20px; 
    z-index: 20;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
    flex-shrink: 0; /* Never shrink footer */
}

/* Energy Cells Slots (UPDATED TO CONTAIN TEXT) */
.exm-cells-container {
    display: flex; gap: 8px; margin-bottom: 20px;
}
.exm-cell {
    flex: 1; height: 50px; /* Taller for text */
    background: rgba(30, 41, 59, 0.5);
    border-radius: 6px; 
    border: 1px solid rgba(255,255,255,0.1);
    
    /* Centering Text */
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-tech);
    font-size: 1.4rem; /* Big Text */
    font-weight: 800;
    color: #475569; /* Empty color */
    
    position: relative; overflow: hidden;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.exm-cell.filled {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--c-primary);
    color: white;
    text-shadow: 0 0 10px var(--c-primary-glow);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.1);
}

/* Input Controls */
.exm-input-grid {
    display: grid; grid-template-columns: 1fr 100px; gap: 15px; align-items: stretch;
}

.exm-input-wrapper { position: relative; }
.exm-cyber-input {
    width: 100%; height: 60px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.15);
    border-left: 4px solid var(--c-accent);
    border-radius: 4px;
    padding: 0 20px;
    color: white; font-family: var(--font-tech);
    font-size: 1.8rem; font-weight: 700;
    transition: 0.2s;
}
.exm-cyber-input:focus {
    outline: none; border-color: var(--c-accent);
    background: rgba(59, 130, 246, 0.05);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}
.exm-input-label {
    position: absolute; top: -8px; left: 10px;
    background: #050a14; padding: 0 5px;
    font-size: 0.6rem; color: var(--c-accent); font-weight: 700;
    font-family: var(--font-tech); letter-spacing: 1px;
}

.exm-btn-execute {
    background: var(--c-primary);
    border: none; border-radius: 4px;
    color: #000; font-weight: 900; font-size: 1rem;
    cursor: pointer;
    clip-path: polygon(10% 0, 100% 0, 100% 90%, 90% 100%, 0 100%, 0 10%);
    transition: 0.2s;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    line-height: 1;
}
.exm-btn-execute:hover {
    background: #34d399; box-shadow: 0 0 20px var(--c-primary-glow); transform: scale(1.02);
}
.exm-btn-execute span { font-size: 0.6rem; margin-top: 4px; opacity: 0.8; }
.exm-btn-execute:disabled {
    background: #334155; color: #64748b; cursor: not-allowed; box-shadow: none;
}

.exm-avg-display {
    margin-top: 15px; display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; background: rgba(255,255,255,0.03); border-radius: 4px;
}
.avg-lbl { font-size: 0.7rem; color: var(--c-text-sec); letter-spacing: 1px; }
.avg-num { font-family: var(--font-tech); font-weight: 700; font-size: 1.2rem; color: white; }

/* --- MOBILE ADJUSTMENTS --- */
@media (max-width: 600px) {
    .ex-modal-window {
        height: 90dvh; /* Maximize space */
        width: 100%;
        border-radius: 20px 20px 0 0; /* Bottom sheet look */
    }
    
    .exm-header, .exm-footer {
        padding: 15px; /* Reduce padding */
    }
    
    .exm-hero-wrapper {
        height: 180px; /* Smaller image on mobile */
    }
    
    .exm-text-section {
        padding: 15px;
    }
    
    .exm-cells-container {
        gap: 4px;
    }
    .exm-cell {
        font-size: 1.1rem;
        height: 40px;
    }
}
