﻿/* ================================
   Tarot Readings – app.css (scoped)
   ================================ */

.tarot-root {
    --bg: #0a0d12;
    --bg2: #070a0f;
    --panel: rgba(255,255,255,.04);
    --panel-brd: rgba(255,255,255,.08);
    --accent: #7b5cff;
    --accent2: #33ffd9;
    --text: #f1f5f9;
    --muted: #95a5b3;
    --card-w: clamp(82px, 12vw, 170px);
    color: var(--text);
    font-family: system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
    /* Ny layout: roten fyller viewporten och är kolumn */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

    /* Bakgrundslager */
    .tarot-root #bg-gradient, .tarot-root #bg-stars, .tarot-root #bg-vignette {
        position: fixed;
        inset: 0;
        pointer-events: none;
    }

    .tarot-root #bg-gradient {
        z-index: -3;
        /*background: radial-gradient(1200px 800px at 10% -20%, #121826 0, transparent 60%), radial-gradient(1000px 600px at 110% -15%, #0d1220 0, transparent 60%), linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);*/
    }

    .tarot-root #bg-stars {
        z-index: -2;
        /*background: radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,.5), rgba(255,255,255,0) 60%), radial-gradient(1.5px 1.5px at 70% 20%, rgba(255,255,255,.45), rgba(255,255,255,0) 60%), radial-gradient(1.2px 1.2px at 40% 80%, rgba(255,255,255,.45), rgba(255,255,255,0) 60%), radial-gradient(1.8px 1.8px at 85% 65%, rgba(255,255,255,.5), rgba(255,255,255,0) 60%);*/
    }

    .tarot-root #bg-vignette {
        z-index: -1;
        /*background: radial-gradient(80% 60% at 50% 35%, rgba(0,0,0,0) 60%, rgba(0,0,0,.35) 100%)*/
    }

    /* Navbar & UI-krom */
    .tarot-root .navbar {
        background: linear-gradient(90deg, rgba(10,13,18,.85), rgba(10,13,18,.55));
        backdrop-filter: blur(8px);
        border-bottom: 1px solid var(--panel-brd);
    }

    .tarot-root .brand-accent {
        background: linear-gradient(90deg, var(--accent), var(--accent2));
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }

    .tarot-root .glass {
        background: var(--panel);
        border: 1px solid var(--panel-brd);
        border-radius: 16px;
        backdrop-filter: blur(8px);
        box-shadow: 0 10px 40px rgba(0,0,0,.35)
    }

    .tarot-root .btn-primary {
        background: linear-gradient(135deg, var(--accent), #5a89ff);
        border: none;
        box-shadow: 0 6px 18px rgba(91,125,255,.3)
    }

    .tarot-root .btn-outline-light {
        border-color: rgba(255,255,255,.25)
    }

    .tarot-root .btn-secondary {
        border: 1px solid rgba(255,255,255,.2);
        background: rgba(255,255,255,.08)
    }

    .tarot-root .form-check-input:checked {
        background-color: var(--accent);
        border-color: var(--accent)
    }

    /* === HÖJD-LAYOUT (ingen JS behövs) ===
   main fyller resterande höjd under nav,
   och delar upp sig i: [kontroller][TAB-ytan][disclaimer] */
    .tarot-root > main.container {
        flex: 1 1 auto;
        display: grid;
        grid-template-rows: auto 1fr auto;
        min-height: 0; /* viktigt för att 1fr ska få krympa inom viewport */
    }

    /* Tab-ytan får växa och krympa inom main */
    .tarot-root .tab-content {
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

        /* Bootstraps .tab-pane är display:none; när aktiv gör vi den flex
   så .board där inne kan centreras med 100% höjd */
        .tarot-root .tab-content > .tab-pane {
            display: none;
        }

            .tarot-root .tab-content > .tab-pane.active {
                display: block!important;
               /* flex: 1 1 auto;*/
                min-height: 0;
                top:30%!important;
                z-index:2000!important;
                position:absolute;
            }

    /* Brädan fyller tab-innehållet och centrerar korten */
    .tarot-root .board {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        position:relative;
        /*top:-150px;*/
    }

    /* Inline board-cut panel used instead of full-screen modal */
    .tarot-root .board-cut {
        display: none; /* toggled by helpers.js with .show/.hide */
        width: 100%;
        background: none;
        box-shadow: none;
        border: none;
        padding: 0;
        margin: 0;
    }
    .tarot-root .board-cut.show {
        display: block;
    }
    .tarot-root .board-cut .cut-ui {
        max-width: 1100px;
        margin: 0 auto;
        background: none;
        border: none;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        width:100%;
    }

    /* Remove glass from cut-head and cut-foot */
    .tarot-root .board-cut .cut-head,
    .tarot-root .board-cut .cut-foot {
        background: none;
        border: none;
        box-shadow: none;
    }

    /* Hide cancel button in cut-head */
    .tarot-root .board-cut #cutCancelBtn {
        display: none !important;
    }

    /* Utility used by JS to hide main board while cutting */
    .tarot-root .d-none { display: none !important; }

    /* Slot & etikett */
    .tarot-root .slot-label {
        font-size: .9rem;
        color: var(--muted);
        text-align: center;
        margin-top: .45rem
    }

    /* Kortslot */
    .tarot-root .card-slot {
        position: relative;
        width: var(--card-w);
        aspect-ratio: 2/3;
        border-radius: 16px;
        overflow: visible;
        box-shadow: 0 12px 40px rgba(0,0,0,.5);
        transition: box-shadow .3s ease, transform .2s ease;
        background: rgba(255,255,255,.02);
    }

        .tarot-root .card-slot.glow {
            box-shadow: 0 12px 40px rgba(0,0,0,.55), 0 0 35px rgba(123,92,255,.25), 0 0 65px rgba(51,255,217,.15);
        }

    /* === KORTBILD – rotation sker innan visning (ingen tween) === */
    .tarot-root .card-face {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: fill;
        filter: drop-shadow(0 6px 12px rgba(0,0,0,.35));
        transform-origin: center center;
        will-change: transform,opacity;
        transition: opacity .25s ease; /* ingen transform-transition */
        transform: rotate(var(--rot1,0deg)) rotate(var(--rot2,0deg)); /* basrotation */
        border: 3px solid #fff;
        border-radius: 10px;
    }

        .tarot-root .card-face.reversed {
            --rot1: 180deg;
        }

        .tarot-root .card-face.cross-rot {
            --rot2: 90deg;
        }

        .tarot-root .card-face.face-hidden {
            opacity: 0;
            transition: none !important;
        }

    .tarot-root .flip-in {
        animation: flipIn .45s ease;
    }

@keyframes flipIn {
    from {
        transform: scale(.96) rotateX(10deg) rotate(var(--rot1,0deg)) rotate(var(--rot2,0deg));
        opacity: .7;
    }

    to {
        transform: scale(1) rotateX(0deg) rotate(var(--rot1,0deg)) rotate(var(--rot2,0deg));
        opacity: 1;
    }
}

/* Celtic Cross grid */
.tarot-root .celtic-grid {
    display: grid;
    gap: min(2vw,16px);
    align-items: center;
    justify-items: center;
    grid-template-columns: repeat(8, minmax(0,1fr));
    grid-auto-rows: 1fr;
    width: 100%;
}

.tarot-root [data-slot] {
    position: relative;
    z-index: 1
}

.tarot-root .cc-pos1 {
    grid-column: 3 / span 2;
    grid-row: 3;
    z-index: 2
}

.tarot-root .cc-pos2 {
    grid-column: 3 / span 2;
    grid-row: 3;
    z-index: 5
}

    .tarot-root .cc-pos2 .card-slot {
        overflow: visible
    }

.tarot-root .crossed-label {
    position: absolute;
    left: 0;
    top: 80%;
    transform: translate(-70%, -50%) rotate(90deg);
    transform-origin: left center;
    color: var(--text);
    opacity: .9;
    font-size: .9rem;
    text-shadow: 0 0 8px rgba(0,0,0,.6);
    pointer-events: none;
    white-space: nowrap;
}

.tarot-root .cc-pos3 {
    grid-column: 3 / span 2;
    grid-row: 4
}

.tarot-root .cc-pos4 {
    grid-column: 2 / span 1;
    grid-row: 3
}

.tarot-root .cc-pos5 {
    grid-column: 3 / span 2;
    grid-row: 2
}

.tarot-root .cc-pos6 {
    grid-column: 6 / span 1;
    grid-row: 3
}

.tarot-root .cc-pos7 {
    grid-column: 8 / span 1;
    grid-row: 2
}

.tarot-root .cc-pos8 {
    grid-column: 8 / span 1;
    grid-row: 3
}

.tarot-root .cc-pos9 {
    grid-column: 8 / span 1;
    grid-row: 4
}

.tarot-root .cc-pos10 {
    grid-column: 8 / span 1;
    grid-row: 5
}

/* Övriga gridar */
.tarot-root .grid-3x2, .tarot-root .grid-2x3, .tarot-root .grid-4x3, .tarot-root .grid-7-arc, .tarot-root .grid-3col {
    display: grid;
    gap: min(2vw,16px);
    align-items: center;
    justify-items: center;
}

.tarot-root .grid-3x2 {
    grid-template-columns: repeat(3, minmax(0,1fr));
    grid-auto-rows: 1fr
}

.tarot-root .grid-2x3 {
    grid-template-columns: repeat(2, minmax(0,1fr));
    grid-auto-rows: 1fr
}

.tarot-root .grid-4x3 {
    grid-template-columns: repeat(4, minmax(0,1fr));
    grid-auto-rows: 1fr
}

.tarot-root .grid-3col {
    grid-template-columns: repeat(3, minmax(0,1fr))
}

.tarot-root .grid-7-arc {
    grid-template-columns: repeat(7, minmax(0,1fr));
    grid-auto-rows: 1fr
}

.tarot-root .hs-1 {
    grid-column: 1;
    grid-row: 2
}

.tarot-root .hs-2 {
    grid-column: 2;
    grid-row: 1
}

.tarot-root .hs-3 {
    grid-column: 3;
    grid-row: 1
}

.tarot-root .hs-4 {
    grid-column: 4;
    grid-row: 1
}

.tarot-root .hs-5 {
    grid-column: 5;
    grid-row: 1
}

.tarot-root .hs-6 {
    grid-column: 6;
    grid-row: 1
}

.tarot-root .hs-7 {
    grid-column: 7;
    grid-row: 2
}

/* Respons */
@media (max-width:576px) {
    .tarot-root .board {
        min-height: 0;
        padding-bottom: 24px;
    }
}

/* FX/Overlay (räknare & mini-deck) */
.tarot-root #fx-layer {
    position: fixed;
    inset: 0;
    z-index: 999;
    pointer-events: none
}

.tarot-root #big-counter {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: clamp(64px, 20vw, 280px);
    letter-spacing: .03em;
    color: rgba(255,255,255,.06);
    text-shadow: 0 0 50px rgba(0,0,0,.6);
    opacity: 0;
    transition: opacity .25s ease;
}

    .tarot-root #big-counter.show {
        opacity: 1
    }

.tarot-root #deck-anim {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: calc(var(--card-w) * .9);
    aspect-ratio: 2/3;
    opacity: 0;
    transition: opacity .25s ease;
    z-index: 1050; /* säkerställ över allt */
    pointer-events: none; /* ta inte emot klick */
}

#deck-anim {
    z-index: 2000 !important;
    display: block !important;
    visibility: visible !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
}

    .tarot-root #deck-anim.show {
        opacity: .95
    }

    .tarot-root #deck-anim .stack {
        position: absolute;
        inset: 0
    }

    .tarot-root #deck-anim .mini-card {
        position: absolute;
        inset: 0;
        background: center/contain no-repeat var(--back-url);
        border-radius: 12px;
        box-shadow: 0 8px 16px rgba(0,0,0,.45)
    }

        .tarot-root #deck-anim .mini-card:nth-child(1) {
            transform: translateY(-4px)
        }

        .tarot-root #deck-anim .mini-card:nth-child(2) {
            transform: translateY(-2px)
        }

        .tarot-root #deck-anim .mini-card:nth-child(3) {
            transform: translateY(0)
        }

        .tarot-root #deck-anim .mini-card:nth-child(4) {
            transform: translateY(2px)
        }

/* Cut-overlay */
.tarot-root #cut-overlay { display: none; }

.tarot-root .board-cut .cut-stage {
    position: relative;
    width: 100%;
    height: clamp(260px, 52vh, 520px);
    overflow: visible;
    border-radius: 12px;
    /*background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.04));
    border: 1px solid var(--panel-brd);*/
    background-color: transparent !important;
    border: 0px !important;
}

.board-cut {
    background-color:transparent;
    border:0px;
}

.cut-stage {
    background-color: transparent!important;
    border: 0px!important;
}

.tarot-root .board-cut.show {
    animation: cutFadeIn .18s ease;
}

@keyframes cutFadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

.tarot-root #cut-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    backdrop-filter: blur(6px);
    background: radial-gradient(80% 60% at 50% 40%, rgba(10,13,18,.85), rgba(10,13,18,.65));
}

.tarot-root #cut-overlay .cut-ui {
    width: min(96vw, 1300px);
    padding: 14px;
    border-radius: 16px;
}

.tarot-root #cut-overlay .cut-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

    .tarot-root #cut-overlay .cut-head .sub {
        color: var(--muted);
        font-size: .9rem;
    }

.tarot-root #cut-overlay .cut-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
}

.tarot-root #cut-overlay .muted {
    color: var(--muted);
    font-size: .9rem;
}

.tarot-root #cut-overlay .pickinfo {
    color: var(--text);
    font-size: .95rem;
}

.tarot-root .cut-card {
    position: absolute;
    width: calc(var(--card-w) * .58);
    aspect-ratio: 2/3;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0,0,0,.45);
    background: center/contain no-repeat var(--back-url);
    transform: translate(-50%, -50%) scale(.88) rotate(0deg);
    left: 50%;
    top: 50%;
    opacity: 0;
    cursor: pointer;
    transition: left .42s ease, top .42s ease, transform .42s cubic-bezier(.2,.6,.2,1), opacity .28s ease;
    outline: none;
    border: none;
}

    .tarot-root .cut-card.spread {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(var(--rot, 0deg));
    }

    .tarot-root .cut-card:hover {
        box-shadow: 0 12px 36px rgba(0,0,0,.55), 0 0 36px rgba(123,92,255,.25);
        transform: translate(-50%, -50%) scale(1.04) rotate(var(--rot, 0deg));
    }

    .tarot-root .cut-card:focus-visible {
        outline: 2px solid var(--accent);
    }

    .tarot-root .cut-card.selected {
        box-shadow: 0 16px 44px rgba(51,255,217,.25), 0 0 42px rgba(51,255,217,.2)
    }

@media (max-width:720px) {
    .tarot-root .cut-card {
        width: calc(var(--card-w) * .52)
    }
}

@media (max-width:380px) {
    .tarot-root #cut-overlay .cut-card {
        width: calc(var(--card-w) * .46)
    }
}

/* 1. Center single card board */
.tarot-root .board > .text-center {
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 3. Style cut-badge for group labels in cut UI */
.tarot-root .cut-badge {
    color: #fff !important;
    background: rgba(0,0,0,0.5) !important;
    border-radius: 8px;
    padding: 2px 10px;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    border: none;
    position: absolute;
    left: 50%;
    top: 8px;
    transform: translateX(-50%);
    z-index: 2;
    pointer-events: none;
    user-select: none;
}

.reading-wrap {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    text-align: left;
    color: #e6e6f0
}

    .reading-wrap h1, .reading-wrap h2, .reading-wrap h3 {
        font-weight: 700
    }

    .reading-wrap img {
        display: block;
        height: auto;
        max-width: 260px;
        width: 100%;
        margin: 0 0 20px 0;
        border:10px solid #fff;
        border-radius:10px;
    }

.loading-panel {
    width: 100%;
    min-height: 96px;
    border: 1px dashed rgba(255,255,255,.25);
    border-radius: 12px;
    background: rgba(0,0,0,.25);
    text-align: center
}

.focusline {
    margin: .25rem 0 1rem;
    font-style: italic;
    opacity: .9
}

.card-block{
    margin-bottom:50px;
}

/* Floating chat overlay styles removed to avoid conflicting with full-screen ChatComponent.
   ChatComponent uses chat.css definitions and its own layout to manage full-viewport behavior. */

.board-host {
    position: relative;
}

.reading-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 1000;
    pointer-events: none; /* klick går igenom till boarden; ändra vid behov */
}

    .reading-overlay::before {
        content: "";
        position: absolute;
        inset: 0;
        background: rgba(0,0,0,.25);
    }

    .reading-overlay .overlay-panel {
        position: relative;
        z-index: 1;
        padding: 14px 18px;
        border-radius: 12px;
        background: rgba(15,19,36,.92);
        border: 1px solid #2a3152;
        box-shadow: 0 8px 40px rgba(0,0,0,.45);
        text-align: center;
        pointer-events: auto;
    }

.overlay-text {
    margin-top: 8px;
    font-weight: 600;
}

.spinner {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,.25);
    border-top-color: rgba(255,255,255,.9);
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* Centrera board-relaterade overlays/FX mot själva boarden */
.board-host {
    position: relative;
    isolation: isolate;
}

    /* Centrerar big counter / deck-anim */
    .board-host #fx-layer {
        position: absolute;
        inset: 0;
        display: grid;
        place-items: center;
        pointer-events: none;
        z-index: 40;
    }

    /* Din ”tolkar-läsningen” overlay ligger redan överst */
    .board-host .reading-overlay {
        z-index: 1000;
    }

/* Centrera knappraden */
.actions-center {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .5rem;
}

/* UL för tabs/spread-väljare centrerad */
.nav.nav-pills.center {
    justify-content: center;
    flex-wrap: wrap;
}


/* --- Minimal modal infra for cut/shuffle --- */
.tarot-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(4px);
    z-index: 9998
}

.tarot-modal-panel {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
    background: rgba(15,19,36,.96);
    border: 1px solid #2a3152;
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 18px 60px rgba(0,0,0,.55);
    z-index: 9999;
    max-width: min(96vw,1100px);
    width: 100%
}

/* Återanvänd nuvarande cut-UI men “låsa” den som modal */
.board-cut.as-modal {
    position: fixed;
    inset: 0;
    display: block;
    z-index: 9999
}

    .board-cut.as-modal .cut-ui {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%,-50%);
        background: transparent;
        border: 0;
        max-width: min(96vw,1100px);
        width: 100%;
        padding: 0
    }


.tarot-root {
    position: relative;
}

/* Låt FX-lagret alltid ligga överst i vyn och vara klick-transparent */
#fx-layer {
    position: fixed;  
    inset: 0;
    z-index: 1100;  
    pointer-events: none;  
}

#deck-anim,
#big-counter {
    position: absolute;
    inset: 0;
}






