/* Zmienne dynamiczne (ustawiane przez JS) */
.tech-modal-overlay {
    --tech-rgb: 100, 116, 139; /* Default Slate */
    
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.4); /* Lżejsze tło */
    backdrop-filter: blur(16px) saturate(180%); /* Mocniejszy blur i nasycenie */
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.tech-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Tekstura szumu w tle */
.tech-modal-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: -1;
}

.tech-modal-content {
    background: #ffffff;
    width: 100%;
    max-width: 580px;
    border-radius: 32px;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.8) inset, /* Wewnetrzny border white */
        0 40px 80px -20px rgba(var(--tech-rgb), 0.3), /* Ambient Glow */
        0 0 0 1px rgba(var(--tech-rgb), 0.1); /* Subtelny obrys kolorem */
    transform: translateY(30px) scale(0.96) rotateX(2deg); /* Lekki tilt na start */
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); /* Ultra smooth */
    transform-origin: center bottom;
    display: flex;
    flex-direction: column;
}

.tech-modal-overlay.active .tech-modal-content {
    transform: translateY(0) scale(1) rotateX(0deg);
    opacity: 1;
}

/* Header z efektem Aurora */
.tech-modal-header {
    height: 200px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #ffffff 100%);
    z-index: 1;
    flex-shrink: 0;
}

/* Dynamiczna poświata w tle - Warstwa 1 */
.tech-modal-header::before {
    content: '';
    position: absolute;
    top: -60%;
    left: -20%;
    width: 140%;
    height: 140%;
    background: radial-gradient(circle at center, rgba(var(--tech-rgb), 0.25) 0%, transparent 70%);
    filter: blur(40px);
    animation: pulseGlow 6s ease-in-out infinite alternate;
    pointer-events: none;
}

/* Dynamiczna poświata w tle - Warstwa 2 (Accent) */
.tech-modal-header::after {
    content: '';
    position: absolute;
    bottom: -20%;
    right: -10%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle at center, rgba(var(--tech-rgb), 0.15) 0%, transparent 60%);
    filter: blur(50px);
    animation: floatGlow 8s linear infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.1); opacity: 1; }
}

@keyframes floatGlow {
    0% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(10px, -10px) rotate(2deg); }
    66% { transform: translate(-5px, 5px) rotate(-2deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

/* Ikona w stylu Ultra Glassmorphism */
.tech-modal-icon-wrapper {
    width: 104px;
    height: 104px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    backdrop-filter: blur(20px) saturate(120%);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 
        0 20px 40px -10px rgba(var(--tech-rgb), 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    transform: translateY(20px);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); /* Spring effect */
}

/* Specular Highlight (Odbicie światła) */
.tech-modal-icon-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 100%);
    border-radius: 32px 32px 0 0;
    opacity: 0.6;
    pointer-events: none;
}

.tech-modal-overlay.active .tech-modal-icon-wrapper {
    transform: translateY(0);
    animation: hoverFloat 5s ease-in-out infinite;
}

@keyframes hoverFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* Przycisk zamknięcia */
.tech-modal-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    border: 1px solid rgba(0,0,0,0.03);
    color: #94a3b8;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tech-modal-close:hover {
    background: white;
    color: rgb(var(--tech-rgb));
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(var(--tech-rgb), 0.15);
}

/* Treść */
.tech-modal-body {
    padding: 1.5rem 3rem 3rem;
    text-align: center;
    position: relative;
    z-index: 2;
    flex-grow: 1; /* Desktop behavior default */
}

.tech-modal-title {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 1rem; /* ZWIEKSZONE z 0.75rem */
    letter-spacing: -0.04em;
    line-height: 1.3; /* ZWIEKSZONE z 1.1 */
    padding-bottom: 0.2rem; /* Dodatkowy padding dla liter j, g, y */
    background: linear-gradient(135deg, #0f172a 60%, rgb(var(--tech-rgb)) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tech-modal-subtitle {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgb(var(--tech-rgb)); 
    margin-bottom: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 1rem;
    background: rgba(var(--tech-rgb), 0.08);
    border-radius: 100px;
    border: 1px solid rgba(var(--tech-rgb), 0.1);
}

.tech-modal-desc {
    font-size: 1.0625rem;
    line-height: 1.75;
    color: #475569;
    margin-bottom: 2.5rem;
    font-weight: 500;
}

/* Tagi Cech */
.tech-modal-features {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.85rem;
    margin-bottom: 3rem;
}

.tech-feature-tag {
    padding: 0.65rem 1.1rem;
    background: #ffffff;
    border-radius: 14px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #334155;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: default;
}

.tech-feature-tag::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #cbd5e1; /* Default grey dot */
    transition: background 0.3s ease;
}

.tech-feature-tag:hover {
    transform: translateY(-3px) scale(1.02);
    border-color: rgba(var(--tech-rgb), 0.4);
    box-shadow: 0 10px 20px -5px rgba(var(--tech-rgb), 0.15);
    color: #0f172a;
}

.tech-feature-tag:hover::before {
    background: rgb(var(--tech-rgb));
    box-shadow: 0 0 8px rgba(var(--tech-rgb), 0.6);
}

/* Przycisk akcji z efektem "Shine" */
.tech-modal-btn {
    width: 100%;
    padding: 1.125rem;
    background: rgb(var(--tech-rgb));
    color: white;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.02em;
    border-radius: 18px;
    box-shadow: 
        0 10px 20px -5px rgba(var(--tech-rgb), 0.4),
        0 0 0 1px rgba(255,255,255,0.2) inset;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transform: translateZ(0); /* Hardware accel */
}

/* Shine Effect Animation */
.tech-modal-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        to right,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.3) 50%,
        rgba(255,255,255,0) 100%
    );
    transform: skewX(-20deg);
    transition: none;
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    20% { left: 200%; } /* Fast sweep */
    100% { left: 200%; } /* Pause */
}

.tech-modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 20px 30px -8px rgba(var(--tech-rgb), 0.5),
        0 0 0 2px rgba(255,255,255,0.3) inset;
}

.tech-modal-btn:active {
    transform: translateY(1px) scale(0.99);
}

/* Footer Container (for desktop structure compatibility) */
.tech-modal-footer {
    margin-top: auto;
}

/* --- MOBILE CENTERED CARD STYLE --- */
@media (max-width: 768px) {
    .tech-modal-overlay {
        align-items: center; /* WYZSRODKOWANIE PIONOWE */
        padding: 1rem; /* Marginesy od krawędzi */
    }

    .tech-modal-content {
        max-width: 100%;
        width: 100%; /* Pełna dostępna szerokość minus padding */
        border-radius: 28px; /* Zaokrąglenie wszędzie */
        transform: scale(0.95); /* Startowa animacja */
        box-shadow: 0 20px 50px -10px rgba(0,0,0,0.25);
        height: auto;
        max-height: 85vh; /* Zostawiamy miejsce góra/dół */
        display: flex;
        flex-direction: column;
    }

    .tech-modal-overlay.active .tech-modal-content {
        transform: scale(1); /* Koniec animacji */
    }

    /* Usunięcie Handle Bar (niepotrzebny w karcie) */
    .tech-modal-header::before {
        display: none;
    }

    .tech-modal-header {
        height: 130px; /* Kompaktowy header */
        flex-shrink: 0;
    }

    .tech-modal-icon-wrapper {
        width: 72px;
        height: 72px;
        border-radius: 24px;
        box-shadow: 0 10px 30px -10px rgba(var(--tech-rgb), 0.2);
    }

    .tech-modal-close {
        top: 16px;
        right: 16px;
        width: 32px;
        height: 32px;
        background: #f1f5f9;
        color: #64748B;
        border: none;
        z-index: 101;
    }

    /* Scrollable Content Area */
    .tech-modal-body {
        padding: 1.25rem 1.25rem 0; /* Padding bottom usunięty, bo footer ma swój */
        flex-grow: 1;
        overflow-y: auto;
        display: block;
    }

    .tech-modal-title {
        font-size: 1.5rem;
        margin-bottom: 0.5rem; /* ZWIEKSZONE z 0.25rem */
        line-height: 1.3; /* ZWIEKSZONE */
        padding-bottom: 0.2rem; /* Dodatkowy padding */
    }

    .tech-modal-subtitle {
        margin-bottom: 1rem;
        font-size: 0.65rem;
    }

    .tech-modal-desc {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
        line-height: 1.5;
    }

    /* Grid 2-kolumnowy na mobile */
    .tech-modal-features {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .tech-feature-tag {
        width: auto;
        padding: 0.6rem;
        background: #f8fafc;
        border: 1px solid #f1f5f9;
        font-size: 0.7rem;
        justify-content: flex-start;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .tech-feature-tag:hover {
        transform: none;
    }

    /* STICKY FOOTER wewnątrz karty */
    .tech-modal-footer {
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 1rem 1.25rem 1.25rem; /* Równe paddingi na dole karty */
        border-top: 1px solid #f1f5f9;
        margin-top: 0;
        z-index: 10;
        width: 100%;
        border-radius: 0 0 28px 28px; /* Dopasowanie do dołu karty */
    }
}
