/* =========================================
   1. GRUNDLAYOUT & PRODUKT-GRID
   ========================================= */
.page-wrapper {
    min-height: calc(100vh - 80px);
    padding: 120px 20px 80px;
    position: relative;
    z-index: 5;
    max-width: 1200px;
    margin: 0 auto;
}

.page-heading {
    font-family: 'Stoneage', sans-serif;
    font-size: clamp(2.5rem, 6vw, 4rem);
    background: linear-gradient(90deg, #60AAFF, #4080FF, #652A75);
    -webkit-background-clip: text;
    color: transparent;
    text-shadow: 0 0 16px rgba(96, 170, 255, 0.7);
    text-align: center;
    margin-bottom: 10px;
}

.page-subtitle {
    font-family: 'Acme', sans-serif;
    font-size: 1.3rem;
    color: var(--text-light);
    text-align: center;
    opacity: 0.9;
    margin-bottom: 4rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 4rem;
    justify-items: center;
    padding: 20px 0;
}

/* --- SCHWEBE-ANIMATION --- */
@keyframes floatCard {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-16px); }
}

.product-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    padding: 2rem;
    width: 100%;
    max-width: 350px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 50px rgba(96, 170, 255, 0.25);
    border-color: rgba(96, 170, 255, 0.4);
}

.product-img-placeholder {
    width: 100%;
    height: 200px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(96, 170, 255, 0.1), rgba(101, 42, 117, 0.2));
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #60AAFF;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    /* KEIN padding */
}

.product-title {
    font-family: 'Stoneage', sans-serif;
    font-size: 1.6rem;
    color: #fff;
    margin-bottom: 10px;
}


/* =========================================
   2. BUTTONS
   ========================================= */
.btn-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
}

.btn-cr-hero {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 220px;
    padding: 14px 28px;
    cursor: pointer;
    border: none;
    background: linear-gradient(135deg, #60AAFF, #4080FF);
    color: #001530;
    border-radius: 50px;
    font-family: 'Stoneage', sans-serif;
    font-size: 1.05rem;
    box-shadow: 0 8px 24px rgba(96, 170, 255, 0.4);
    transition: transform 0.3s, box-shadow 0.3s, color 0.3s, background 0.3s;
    text-decoration: none;
    position: relative;
}

.btn-cr-hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(96, 170, 255, 0.6);
}

.btn-cr-hero:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(96, 170, 255, 0.3);
}

/* Produkt-Karten-Button: Klick von der Karte gefangen */
.btn-product {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #60AAFF;
    color: #60AAFF;
    box-shadow: none;
}

.product-card:hover .btn-product {
    background: #60AAFF;
    color: #001530;
}

.btn-success {
    background: linear-gradient(135deg, #00CC66, #208040) !important;
    box-shadow: 0 8px 24px rgba(0, 204, 102, 0.4) !important;
    color: #fff !important;
}

.btn-success:hover {
    box-shadow: 0 12px 36px rgba(0, 204, 102, 0.6) !important;
}

.berg-container {
    pointer-events: none;
}

.page-subtitle {
    pointer-events: none;
}

.download-heading {
    pointer-events: none;
}

.download-subtitle {
    pointer-events: none;
}


/* =========================================
   3. MODAL / POPUP OVERLAY
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;              /* HIDDEN by default */
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.modal-overlay.active {
    display: flex;              /* SICHTBAR */
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    width: 100%;
    max-width: 620px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.close-modal-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2rem;
    font-family: sans-serif;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.3s, transform 0.3s, color 0.3s;
    z-index: 10;
    padding: 8px;
    line-height: 1;
}

.close-modal-btn:hover {
    opacity: 1;
    transform: scale(1.15);
    color: #ff4d4d;
}


/* =========================================
   4. TERMINAL PANEL
   ========================================= */
.download-panel {
    padding: 3rem 2rem 2rem;
    text-align: center;
    background: rgba(16, 20, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.download-heading {
    font-family: 'Stoneage', sans-serif;
    color: #fff;
    margin-bottom: 4px;
}

.download-subtitle {
    font-family: 'Acme', sans-serif;
    color: #aaa;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

#modalBody {
    overflow-y: auto;
    max-height: 55vh;
    padding: 0.5rem 0.25rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(96, 170, 255, 0.3) transparent;
    -webkit-overflow-scrolling: touch;
}

#modalBody::-webkit-scrollbar {
    width: 6px;
}
#modalBody::-webkit-scrollbar-track {
    background: transparent;
}
#modalBody::-webkit-scrollbar-thumb {
    background: rgba(96, 170, 255, 0.3);
    border-radius: 3px;
}


/* =========================================
   5. DOWNLOAD-KARTEN IM MODAL
   ========================================= */
.dl-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.4rem 1.6rem;
    margin-bottom: 0.8rem;
    transition: border-color 0.3s, background 0.3s;
}

.dl-card:last-child {
    margin-bottom: 0;
}

.dl-card:hover {
    border-color: rgba(96, 170, 255, 0.2);
    background: rgba(255, 255, 255, 0.04);
}

.dl-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
    text-align: left;
}

.dl-card-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(96, 170, 255, 0.15), rgba(101, 42, 117, 0.15));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #60AAFF;
    flex-shrink: 0;
    overflow: hidden;
}

.dl-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.dl-card-info {
    min-width: 0;
    overflow: hidden;
}

.dl-card-title {
    font-family: 'Stoneage', sans-serif;
    font-size: 1.1rem;
    color: #fff;
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dl-card-filename {
    font-size: 0.78rem;
    color: #607090;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.3px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Code-Eingabe */
.dl-input-area {
    transition: opacity 0.3s;
}

.dl-input-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-bottom: 1rem;
}

.dl-input-wrapper .cr-code-input {
    width: 72px;
    height: 56px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(96, 170, 255, 0.2);
    border-radius: 12px;
    color: #fff;
    font-family: 'Stoneage', sans-serif;
    font-size: max(1.2rem, 16px); /* 16px minimum verhindert iOS Auto-Zoom */
    text-align: center;
    text-transform: uppercase;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.dl-input-wrapper .cr-code-input:focus {
    outline: none;
    border-color: #60AAFF;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 18px rgba(96, 170, 255, 0.4), inset 0 0 8px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.dl-input-wrapper .cr-code-input:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.5);
}

.dl-separator {
    color: rgba(96, 170, 255, 0.5);
    font-family: 'Stoneage', sans-serif;
    font-size: 1.6rem;
    user-select: none;
}

.dl-btn-container {
    display: flex;
    justify-content: center;
}

.dl-btn-container .btn-verify {
    min-width: 200px;
    font-size: 0.95rem;
    padding: 12px 24px;
}

/* Error */
.dl-error {
    color: #ff8888;
    font-family: 'Acme', sans-serif;
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
    padding: 10px 14px;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.25);
    border-radius: 10px;
    text-align: center;
}

/* Success Area */
.dl-success-area {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding-top: 0.8rem;
    border-top: 1px dashed rgba(96, 170, 255, 0.15);
    margin-top: 0.5rem;
    animation: fadeSlideIn 0.4s ease forwards;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dl-success-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Acme', sans-serif;
    font-size: 1rem;
    color: #00CC66;
    text-shadow: 0 0 8px rgba(0, 204, 102, 0.3);
}

.dl-success-info i {
    font-size: 1.3rem;
}

.dl-success-area .btn-download {
    min-width: 200px;
    font-size: 0.95rem;
    padding: 12px 24px;
    background: linear-gradient(135deg, #00CC66, #208040);
    box-shadow: 0 6px 20px rgba(0, 204, 102, 0.35);
    color: #fff;
}

.dl-success-area .btn-download:hover {
    box-shadow: 0 10px 30px rgba(0, 204, 102, 0.55);
}

/* Loading & Error im Modal */
.modal-loading {
    text-align: center;
    padding: 3rem 1rem;
    color: #607090;
    font-family: 'Acme', sans-serif;
    font-size: 1.1rem;
}

.modal-loading i {
    margin-right: 8px;
    color: #60AAFF;
}

.modal-error {
    color: #ff8888;
    text-align: center;
    padding: 2rem 1rem;
    font-family: 'Acme', sans-serif;
}


/* =========================================
   6. ANIMATIONEN
   ========================================= */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%, 75% { transform: translateX(-8px); }
    50% { transform: translateX(8px); }
}

.shake-error {
    animation: shake 0.4s ease-in-out;
}


/* =========================================
   7. RESPONSIVE — TABLET
   ========================================= */
@media (max-width: 900px) {
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 2.5rem;
    }

    .product-card {
        max-width: 320px;
        padding: 1.5rem;
    }

    .product-img-placeholder {
        height: 150px;
    }

    .product-title {
        font-size: 1.4rem;
    }
}

/* Tap-Feedback auf Touch-Geräten */
.product-card:active {
    transform: scale(0.97);
    border-color: rgba(96, 170, 255, 0.4);
}

.product-icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 12px;
}

/* =========================================
   8. RESPONSIVE — MOBILE
   ========================================= */
@media (max-width: 600px) {
    .page-wrapper {
        padding: 100px 12px 60px;
    }

    .page-heading {
        font-size: 2.2rem;
    }

    .page-subtitle {
        font-size: 1.1rem;
        margin-bottom: 2rem;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .product-card {
        max-width: 100%;
        padding: 1.5rem;
        animation: none; /* Kein Float auf Mobile */
    }

     .product-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 20px 50px rgba(96, 170, 255, 0.25);
        border-color: rgba(96, 170, 255, 0.4);
    }

    .product-card:hover .btn-product {
        background: #60AAFF;
        color: #001530;
    }

    .product-img-placeholder {
        height: 130px;
        font-size: 2.2rem;
    }

    .product-title {
        font-size: 1.3rem;
    }

    .btn-product {
        font-size: 0.9rem;
        padding: 12px 20px;
        min-width: unset;
        width: 100%;
    }

    /* Modal als Bottom-Sheet */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal-content {
        width: 100%;
        max-height: 92vh;
    }

    .download-panel {
        padding: 2rem 1rem 1.5rem;
        border-radius: 22px 22px 0 0;
    }

    .download-heading {
        font-size: 1.6rem !important;
    }

    .download-subtitle {
        font-size: 0.9rem;
    }

    #modalBody {
        max-height: 60vh;
    }

    .dl-card {
        padding: 1rem;
    }

    .dl-card-header {
        gap: 0.7rem;
        margin-bottom: 1rem;
    }

    .dl-card-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .dl-card-title {
        font-size: 0.95rem;
    }

    .dl-card-filename {
        font-size: 0.7rem;
    }

    .dl-input-wrapper {
        gap: 2px;
    }

    .dl-input-wrapper .cr-code-input {
        width: 60px;
        height: 48px;
        font-size: 16px;
        border-radius: 10px;
    }

    .dl-separator {
        font-size: 1.2rem;
    }

    .btn-cr-hero {
        width: 100%;
        min-width: unset;
        font-size: 0.95rem;
        padding: 13px 20px;
    }

    .dl-btn-container .btn-verify,
    .dl-success-area .btn-download {
        width: 100%;
        min-width: unset;
    }

    .dl-success-info {
        font-size: 0.9rem;
        text-align: center;
        flex-wrap: wrap;
        justify-content: center;
    }

    .close-modal-btn {
        top: 8px;
        right: 12px;
        font-size: 1.8rem;
        padding: 12px;
    }
}

/* Extra klein (iPhone SE etc.) */
@media (max-width: 380px) {
    .dl-input-wrapper .cr-code-input {
        width: 52px;
        height: 44px;
    }

    .dl-card {
        padding: 0.8rem;
    }

    .download-panel {
        padding: 1.5rem 0.8rem 1rem;
    }
}

/* Hover NUR auf Geräten mit Maus */
@media (hover: hover) {
    .product-card {
        transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    }
    .product-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 20px 50px rgba(96, 170, 255, 0.25);
        border-color: rgba(96, 170, 255, 0.4);
    }
    .product-card:hover .btn-product {
        background: #60AAFF;
        color: #001530;
    }
}

/* Touch-Feedback: nur kurzer visueller Tap */
.product-card:active {
    border-color: rgba(96, 170, 255, 0.4);
    box-shadow: 0 5px 15px rgba(96, 170, 255, 0.2);
}

