/* ============================================================
   COMPONENTS.CSS
   (Tooltip, InfoBox, ScoreBox, WhyBox, Calculator, DemoGIF)
============================================================ */

/* ============================================================
   TOOLTIP
============================================================ */
#tooltip {
    display: none;
    position: absolute;
    max-width: 240px;
    background: #ffffff;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    z-index: 9999;
    font-size: 13px;
    line-height: 1.4;
}

.info-icon {
    cursor: pointer;
    margin-left: 6px;
    font-size: 18px;
    opacity: 0.7;
}

.info-icon:hover {
    opacity: 1;
    transform: scale(1.15);
}

/* ============================================================
   COLLAPSIBLE INFO BOX
============================================================ */
.info-box-collapsible {
    background: #eef2ff;
    border-left: 5px solid #4f46e5;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

#infoButton {
    background: #4f46e5;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

#infoButton:hover {
    background: #3730a3;
}

.info-content {
    overflow: hidden;
    max-height: 0;
    margin-top: 12px;
    transition: max-height 0.35s ease;
}

/* ============================================================
   SCORE BOX
============================================================ */
.score-box {
    background: #e0fbe0;
    border-left: 5px solid #2ecc71;
    padding: 10px 14px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 18px;
    width: fit-content;
}

/* ============================================================
   WHY-BOX (Fehleranalyse)
============================================================ */
.why-wrapper {
    background: #ffeaea;
    border-left: 4px solid #ff4d4f;
    padding: 10px;
    margin-top: 10px;
    border-radius: 6px;
}

.why-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: bold;
    margin-bottom: 5px;
}

.why-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #444;
}

.why-content {
    max-height: 0;
    overflow: hidden;
    padding-left: 5px;
    transition: max-height 0.3s ease;
}

.why-content.open {
    max-height: 800px;
}

/* ============================================================
   CORRECT / WRONG CARDS
============================================================ */
.card.correct {
    border: 2px solid #2ecc71 !important;
    background: #eaffea !important;
}

.card.wrong {
    border: 2px solid #e74c3c !important;
    background: #ffeaea !important;
}

/* +1 Animation */
.plus-one {
    position: absolute;
    color: #2ecc71;
    font-size: 26px;
    font-weight: bold;
    animation: plusOneAnim 0.8s ease-out forwards;
    pointer-events: none;
    z-index: 9999;
}

@keyframes plusOneAnim {
    0% { opacity: 0; transform: translateY(0) scale(0.8); }
    20% { opacity: 1; transform: translateY(-10px) scale(1); }
    100% { opacity: 0; transform: translateY(-35px) scale(1.4); }
}

/* ============================================================
   TASCHENRECHNER (sauber & final)
============================================================ */

#calc-container {
  position: sticky;
  top: 24px;

  background: #ffffff;
  border-radius: 16px;
  padding: 16px;

  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}


#calc-tab {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 12px;
    color: #1f2937;
}

#calc-panel {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

#calc-display {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    padding: 12px;
    font-size: 26px;
    text-align: right;
    margin-bottom: 10px;
    border-radius: 8px;
    color: #1e1b4b;
    font-weight: bold;
}

/* Buttons */
.calc-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.calc-row button {
    flex: 1;
    padding: 10px;
    font-size: 18px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    cursor: pointer;
    color: #334155;
    transition: background 0.2s ease, transform 0.1s ease;
}

.calc-row button:hover {
    background: #e0e7ff;
}

.calc-row button:active {
    transform: scale(0.97);
}

.calc-row button[data-op] {
    background: #ede9fe;
    color: #4f46e5;
    font-weight: bold;
}

.equals-btn {
    background: #4f46e5 !important;
    color: white !important;
    font-weight: bold;
    border: 1px solid #4338ca;
}

.clear-btn {
    background: #fee2e2 !important;
    color: #b91c1c !important;
    font-weight: bold;
}

/* ============================================================
   DEMO GIF (DragDrop Animation)
============================================================ */
#demo-gif {
    width: 260px;
    height: 120px;
    position: relative;
    margin-top: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.demo-dropzone {
    position: absolute;
    width: 100px;
    height: 40px;
    border: 2px dashed #bbb;
    border-radius: 6px;
    top: 40px;
    left: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.demo-box {
    position: absolute;
    top: 40px;
    left: 10px;
    padding: 8px 12px;
    background: #3b82f6;
    border-radius: 6px;
    color: white;
    font-weight: bold;
    animation: moveBox 3s infinite;
}

.demo-hand {
    width: 32px;
    height: 32px;
    background: url('https://upload.wikimedia.org/wikipedia/commons/3/3c/Cursor_hand2.svg');
    background-size: cover;
    position: absolute;
    top: 25px;
    left: -40px;
    animation: moveHand 3s infinite;
}

@keyframes moveBox {
    0%   { left: 10px; opacity: 1; }
    40%  { left: 140px; }
    55%  { opacity: 0; }
    75%  { left: 10px; opacity: 0; }
    100% { opacity: 1; }
}

@keyframes moveHand {
    0%   { left: -40px; opacity: 1; }
    40%  { left: 110px; }
    55%  { opacity: 0; }
    75%  { left: -40px; opacity: 0; }
    100% { opacity: 1; }
}

/* ================================================
   Kategorie 2 – Mehrzeiliger Buchungssatz GIF
================================================ */

#gif-multiline {
    width: 360px;
    height: 190px;
    position: relative;
    margin-top: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    padding: 10px;
}

/* Zeilen */
.gif-line {
    position: absolute;
    left: -220px; /* kommt von links rein */
    width: 200px;
    padding: 6px 10px;
    background: #eef2ff;
    border-radius: 6px;
    font-weight: bold;
    animation: slideIn 3s infinite;
}

/* einzelne Zeilen zeitversetzt */

.gif-waren {
    top: 20px;
    animation-delay: 0s;
}
.gif-vst {
    top: 60px;
    animation-delay: 0.5s;
}
.gif-verbindlich {
    top: 100px;
    background: #fde047; /* gelb = Haben */
    animation-delay: 1s;
}


/* Keyframes */
@keyframes slideIn {
    0% { left: -220px; opacity: 0; }
    30% { left: 20px; opacity: 1; }
    70% { left: 20px; opacity: 1; }
    100% { left: -220px; opacity: 0; }
}

@keyframes handMove {
    0% { left: -40px; opacity: 1; }
    30% { left: 0px; }
    70% { left: 0px; }
    100% { left: -40px; opacity: 0; }
}

.drill-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 44px auto 18px;
    padding: 18px 34px;
    min-height: 64px;
    width: min(100%, 480px);
    font-size: 1.28rem;
    font-weight: 900;
    color: #ffffff;
    background: #1d5f77;
    border-radius: 14px;
    border: 1px solid #174e63;
    box-shadow: 0 14px 28px rgba(29, 95, 119, 0.22);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.drill-btn:hover {
    background: #174e63;
    box-shadow: 0 18px 32px rgba(29, 95, 119, 0.28);
    transform: translateY(-1px);
}

.exercise-card .btn {
    display: inline-block;
    padding: 10px 18px;
    background: #3b82f6;
    color: white;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
}

/* ================================
   Übungskategorien – Card Layout
================================ */

#categoryList {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 8px;
    padding-bottom: 8px;
}

.exercise-card {
    width: 100%;
    min-height: 100%;
    background: #ffffff;
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(226, 232, 240, 0.92);
    text-align: left;
    transition: 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.exercise-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
}

.exercise-card-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.exercise-card-tag,
.exercise-card-meta {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.exercise-card-tag {
    padding: 6px 10px;
    background: #f0fdfa;
    color: #0f766e;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.exercise-card-meta {
    color: #64748b;
}

.exercise-icon-wrap {
    display: flex;
}

.exercise-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    font-size: 31px;
    border-radius: 18px;
    background: #f8fafc;
}

.exercise-card h2 {
    font-size: 23px;
    line-height: 1.14;
    letter-spacing: -0.03em;
    font-weight: 800;
    margin: 0;
    color: #12243c;
}

.exercise-desc {
    font-size: 15px;
    line-height: 1.7;
    color: #5c7086;
    flex: 1;
}

.exercise-card-footer {
    margin-top: auto;
    padding-top: 4px;
}

.exercise-card .open-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-width: 154px;
    padding: 12px 18px;
    border-radius: 12px;
    background: #0f766e;
    color: white;
    font-weight: 700;
    text-decoration: none;
    transition: 0.18s ease;
}

.exercise-card .open-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(15, 118, 110, 0.18);
}

.exercise-card-mint .exercise-card-tag {
    background: #ecfeff;
    color: #0f766e;
}

.exercise-card-mint .exercise-icon {
    background: #ecfeff;
}

.exercise-card-amber .exercise-card-tag {
    background: #fffbeb;
    color: #b45309;
}

.exercise-card-amber .exercise-icon {
    background: #fffbeb;
}

.exercise-card-sky .exercise-card-tag {
    background: #eff6ff;
    color: #1d4ed8;
}

.exercise-card-sky .exercise-icon {
    background: #eff6ff;
}

.story-action-btn {
    width: 100%;
    padding: 10px 0;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    margin-top: 10px;
    cursor: pointer;
    border: none;
}

.story-continue {
    background: #10b981;
    color: white;
}

.story-reset {
    background: #ef4444;
    color: white;
}

.story-reset:hover {
    background: #dc2626;
}

.story-continue:hover {
    background: #0ea96a;
}
