/**
 * @package     Villaester.Module
 * @subpackage  mod_vmm_ankaufsrechner
 * @copyright   Copyright (C) 2026 Villaester Moderne Medien GmbH
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 *
 * tableCalc-Layout — scope: .mod-vmm-ankaufsrechner--tablecalc
 */

/* Glanz-Animation: alle 20 Sekunden über das Grid */
@keyframes vmm-tablecalc-shine {
    0%   { transform: translateX(-160%) skewX(-14deg); opacity: 0; }
    5%   { opacity: 1; }
    28%  { transform: translateX(230%)  skewX(-14deg); opacity: 1; }
    33%  { opacity: 0; }
    100% { transform: translateX(230%)  skewX(-14deg); opacity: 0; }
}

/* =========================================================
   Modul-Wrapper
   ========================================================= */
.mod-vmm-ankaufsrechner--tablecalc {
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #333;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-headline {
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin: 0 0 1rem;
    color: #222;
}

/* =========================================================
   Grid-Wrapper — äußerer Rahmen + Glanzeffekt
   ========================================================= */
.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-grid-wrap {
    position: relative;
    overflow: hidden;
    background: transparent;
    border: none;
    padding: 0;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-grid-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 40%;
    height: 100%;
    background: linear-gradient(
        to right,
        transparent 0%,
        rgba(255, 255, 255, 0.15) 45%,
        rgba(255, 255, 255, 0.28) 50%,
        rgba(255, 255, 255, 0.15) 55%,
        transparent 100%
    );
    animation: vmm-tablecalc-shine 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 3;
}

/* =========================================================
   Grid: 3 Spalten (Gold | Silber | Platin+Palladium)
   ========================================================= */
.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    align-items: stretch;
}

/* Noble: transparente Hülle, Subgroups füllen die Höhe gleichmäßig */
.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-col--noble {
    background: transparent !important;
    border: none;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* =========================================================
   Karten — gemeinsamer Basis-Style
   ========================================================= */
.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-col {
    border-radius: 0;
    overflow: hidden;
    border: 1px solid #d6d2cc;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Subgroups: kein Rahmen, weißer Hintergrund, strecken sich auf verfügbare Höhe */
.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-subgroup {
    border-radius: 0;
    overflow: hidden;
    border: none;
    box-shadow: none;
    background: #fff;
    flex: 1;
}

/* =========================================================
   Karten-Hintergründe — flat, sehr hell
   ========================================================= */
.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-col--gold {
    background: #fefaf0;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-col--silver {
    background: #f8f8f8;
    display: flex;
    flex-direction: column;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-col--silver .vmm-tablecalc-row {
    flex: 1;
}

/* =========================================================
   Spalten-Header — solides Türkis
   ========================================================= */
.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #1ca0a7;
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-unit {
    font-weight: 400;
    font-size: 0.72rem;
    opacity: 0.85;
    text-transform: none;
    letter-spacing: 0;
}

/* =========================================================
   Zeilen — weiß / sehr leicht getönt, alternierend
   ========================================================= */
.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 5px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: #fff;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-row:nth-child(even) {
    background: transparent;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-row:last-child {
    border-bottom: none;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-label {
    font-size: 0.84rem;
    color: #333;
    font-weight: 500;
    flex-shrink: 0;
    white-space: nowrap;
}

/* =========================================================
   Input
   ========================================================= */
.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-input,
.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-input.uk-input {
    width: 90px !important;
    height: 28px !important;
    min-height: 0 !important;
    padding: 2px 8px !important;
    font-size: 0.84rem !important;
    text-align: right !important;
    border: 1px solid #ccc !important;
    border-radius: 3px !important;
    background: #fff !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06) !important;
    flex-shrink: 0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-input:focus,
.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-input.uk-input:focus {
    border-color: #1ca0a7 !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(28, 160, 167, 0.18) !important;
}

/* =========================================================
   Bottom-Row: Value-Bar + optionaler Form-Bereich
   ========================================================= */
.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-bottom-row {
    display: flex;
    flex-direction: column;
    margin-top: 1rem;
    gap: 1rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.6s ease, opacity 0.4s ease 0.1s, margin-top 0.4s ease;
    margin-top: 0;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-bottom-row.is-visible {
    max-height: 1200px;
    opacity: 1;
    margin-top: 1rem;
}

/* Konfetti-Canvas — direkt am body, daher KEIN Modul-Scope */
.vmm-tablecalc-confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99999;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-value-bar {
    background: #1ca0a7;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    padding: 1.5rem 2rem;
    flex: 1 1 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-radius: 0;
}


.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-value-label {
    font-weight: 800;
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: center;
    text-shadow: inherit;
}

/* Innenkasten: Disclaimer + Betrag */
.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-value-total-box {
    background: rgba(0, 0, 0, 0.07);
    border-radius: 0;
    padding: 1rem 1.5rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-value-disclaimer {
    font-size: 0.72rem;
    opacity: 0.7;
    margin: 0 0 0.4rem;
    line-height: 1.35;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-value-amount {
    font-size: 2.6rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

/* Detailaufschlüsselung */
.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-breakdown {
    background: rgba(0, 0, 0, 0.07);
    border-radius: 0;
    padding: 1rem 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-breakdown-title {
    font-weight: 700;
    font-size: 0.82rem;
    margin: 0 0 0.6rem;
    opacity: 0.8;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 0.83rem;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-breakdown-item:last-child {
    border-bottom: none;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-breakdown-grams {
    flex: 0 0 auto;
    white-space: nowrap;
    font-weight: 600;
    min-width: 90px;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-breakdown-label {
    flex: 1 1 auto;
    text-align: center;
    opacity: 0.75;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-breakdown-value {
    flex: 0 0 auto;
    white-space: nowrap;
    font-weight: 700;
    min-width: 110px;
    text-align: right;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-breakdown-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.6rem;
    padding-top: 0.5rem;
    border-top: 2px solid rgba(0, 0, 0, 0.15);
    font-weight: 800;
    font-size: 0.9rem;
}

/* Form-Area */
.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-form-area {
    flex: 1 1 45%;
    background: #f6f3ee;
    border-left: 1px solid rgba(0, 0, 0, 0.07);
    padding: 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 0 0 6px 0;
}

/* =========================================================
   Berechnen-Button — zwischen Grid und Result-Section
   ========================================================= */
.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-calculate-wrap {
    display: flex;
    justify-content: center;
    padding: 1.25rem 0 0.5rem;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-calculate-btn {
    display: inline-block;
    padding: 0.7rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: #1ca0a7;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-calculate-btn:hover,
.mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-calculate-btn:focus {
    background: #178a90;
    outline: none;
}

/* Footer */
.mod-vmm-ankaufsrechner--tablecalc .ankaufsrechner-footer-disclaimer {
    margin: 0.5rem 0 0;
    font-size: 0.65rem;
    color: #aaa;
    line-height: 1.3;
}

/* =========================================================
   Responsive
   ========================================================= */

/* Tablet: 3 → 1 Spalte, kompaktere Rows */
@media (max-width: 768px) {
    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-grid {
        grid-template-columns: 1fr;
    }

    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-grid-wrap {
        padding: 8px 8px 0;
    }

    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-header {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-row {
        padding: 3px 10px;
    }

    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-label {
        font-size: 0.8rem;
    }

    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-input,
    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-input.uk-input {
        height: 24px !important;
        font-size: 0.8rem !important;
        padding: 1px 6px !important;
    }

    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-bottom-row {
        flex-direction: column;
    }

    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-value-bar,
    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-value-bar:not(:only-child) {
        flex: none;
        border-radius: 0;
    }

    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-form-area {
        border-left: none;
        border-top: 1px solid rgba(0, 0, 0, 0.07);
        border-radius: 0 0 6px 6px;
    }
}

/* Mobile: noch kompaktere Darstellung */
@media (max-width: 580px) {
    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-grid {
        grid-template-columns: 1fr;
    }

    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-header {
        padding: 4px 8px;
        font-size: 0.72rem;
    }

    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-row {
        padding: 2px 8px;
    }

    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-label {
        font-size: 0.78rem;
    }

    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-input,
    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-input.uk-input {
        width: 100px !important;
        height: 22px !important;
        font-size: 0.78rem !important;
        padding: 1px 5px !important;
    }

    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-value-bar {
        padding: 1.25rem 1.25rem;
    }

    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-value-amount {
        font-size: 2rem;
    }

    .mod-vmm-ankaufsrechner--tablecalc .vmm-tablecalc-calculate-btn {
        width: 100%;
    }
}
