/* ==========================================================================
   Don Pizza - Order Tracking Mini-Games Widget Styles
   ========================================================================== */

:root {
    --pgt-primary: #e52d27;
    --pgt-primary-hover: #b31217;
    --pgt-accent: #f39c12;
    --pgt-accent-hover: #d68910;
    --pgt-dark: #1e1e24;
    --pgt-card-bg: #2b2b36;
    --pgt-light: #ffffff;
    --pgt-muted: #a0a0a8;
    --pgt-radius: 12px;
    --pgt-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

/* Accordion Outer Container */
.pgt-wrapper {
    margin: 20px auto;
    max-width: 420px;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-sizing: border-box;
}

.pgt-wrapper * {
    box-sizing: border-box;
}

/* Collapsed Trigger Button */
.pgt-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 18px;
    background: linear-gradient(135deg, #e52d27 0%, #b31217 100%);
    color: #ffffff !important;
    border: none;
    border-radius: var(--pgt-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(229, 45, 39, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    text-align: left;
    user-select: none;
    line-height: 1.3;
}

.pgt-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(229, 45, 39, 0.45);
    color: #ffffff !important;
    text-decoration: none;
}

.pgt-trigger-cta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 13px;
    white-space: nowrap;
}

.pgt-trigger.pgt-active .pgt-chevron {
    transform: rotate(180deg);
}

.pgt-chevron {
    transition: transform 0.3s ease;
    display: inline-block;
}

/* Accordion Body */
.pgt-body {
    display: none;
    background: var(--pgt-dark);
    border-radius: var(--pgt-radius);
    padding: 16px;
    margin-top: 10px;
    box-shadow: var(--pgt-shadow);
    color: #ffffff;
    animation: pgtSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pgt-body.pgt-open {
    display: block;
}

@keyframes pgtSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Widget Header */
.pgt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 12px;
}

.pgt-title-box {
    display: flex;
    flex-direction: column;
}

.pgt-title {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.pgt-subtitle {
    font-size: 11px;
    color: var(--pgt-muted);
    margin-top: 2px;
}

.pgt-level-indicator {
    font-size: 12px;
    color: var(--pgt-accent);
    font-weight: 600;
    margin-top: 2px;
}

.pgt-close-btn {
    background: transparent;
    border: none;
    color: var(--pgt-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.pgt-close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* Gameplay Instruction Hint Bar */
.pgt-instructions {
    max-width: 300px;
    width: 100%;
    margin: 0 auto 10px auto;
    padding: 7px 12px;
    background: rgba(243, 156, 18, 0.12);
    border: 1px solid rgba(243, 156, 18, 0.28);
    border-radius: 6px;
    color: #f8c257;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.pgt-instructions-icon {
    font-size: 14px;
    flex-shrink: 0;
}

/* Fixed 300x300 Game Viewport */
.pgt-viewport {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto;
    background: #111116;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
    user-select: none;
    -webkit-user-select: none;
}

/* Controls / Footer Bar */
.pgt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pgt-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.pgt-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.pgt-btn:active {
    transform: scale(0.96);
}

.pgt-status-tag {
    font-size: 11px;
    color: var(--pgt-muted);
}

.pgt-status-tag b {
    color: var(--pgt-accent);
}

/* ==========================================================================
   Overlay Cards: Interstitial & Game Complete
   ========================================================================== */

.pgt-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(20, 20, 26, 0.94);
    backdrop-filter: blur(6px);
    z-index: 50;
    text-align: center;
    padding: 20px;
    animation: pgtFadeIn 0.3s ease;
}

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

.pgt-overlay-icon {
    font-size: 42px;
    margin-bottom: 10px;
}

.pgt-overlay-title {
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
    line-height: 1.3;
}

.pgt-overlay-sub {
    font-size: 13px;
    color: var(--pgt-muted);
    margin-bottom: 16px;
}

/* ==========================================================================
   Stage 1: Rotate Tile Puzzle
   ========================================================================== */

.pgt-rotate-grid {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-template-rows: repeat(3, 100px);
    width: 300px;
    height: 300px;
    background: #000;
}

.pgt-rotate-tile {
    width: 100px;
    height: 100px;
    cursor: pointer;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
    background-size: 300px 300px;
    background-repeat: no-repeat;
}

.pgt-rotate-tile:hover {
    filter: brightness(1.1);
}

/* ==========================================================================
   Stage 2: Tile Swap Puzzle
   ========================================================================== */

.pgt-swap-grid {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-template-rows: repeat(3, 100px);
    width: 300px;
    height: 300px;
    background: #000;
}

.pgt-swap-tile {
    width: 100px;
    height: 100px;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
    background-size: 300px 300px;
    background-repeat: no-repeat;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pgt-swap-tile:hover {
    filter: brightness(1.1);
}

.pgt-swap-tile.pgt-selected {
    box-shadow: inset 0 0 0 3px var(--pgt-accent), 0 0 10px var(--pgt-accent);
    transform: scale(0.94);
    z-index: 5;
}

/* ==========================================================================
   Stage 3: Split Image Memory
   ========================================================================== */

.pgt-memory-grid {
    display: grid;
    grid-template-columns: repeat(3, 94px);
    grid-template-rows: repeat(2, 140px);
    gap: 6px;
    padding: 7px;
    width: 300px;
    height: 300px;
    perspective: 800px;
}

.pgt-memory-card {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 6px;
}

.pgt-memory-card.pgt-flipped,
.pgt-memory-card.pgt-matched {
    transform: rotateY(180deg);
}

.pgt-memory-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pgt-memory-back {
    background: linear-gradient(135deg, #333344 0%, #1e1e24 100%);
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: var(--pgt-accent);
    font-size: 26px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.pgt-memory-front {
    transform: rotateY(180deg);
    border: 2px solid var(--pgt-accent);
    background-size: cover;
    background-position: center;
}

.pgt-memory-card.pgt-matched .pgt-memory-front {
    border-color: #27ae60;
    filter: brightness(1.05);
}

.pgt-memory-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(22, 101, 192, 0.88);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 2;
}

/* ==========================================================================
   Stage 4, 6, 7: HTML5 Canvas Container
   ========================================================================== */

.pgt-canvas {
    display: block;
    width: 300px;
    height: 300px;
    touch-action: none;
}

/* ==========================================================================
   Stage 5: Fragment / Shatter Puzzle
   ========================================================================== */

.pgt-fragment-stage {
    position: relative;
    width: 300px;
    height: 300px;
    background: #111116;
    overflow: hidden;
}

.pgt-fragment-silhouette {
    position: absolute;
    inset: 0;
    opacity: 0.18;
    background-size: cover;
    background-position: center;
    filter: grayscale(1);
    pointer-events: none;
}

.pgt-fragment-piece {
    position: absolute;
    width: 300px;
    height: 300px;
    background-size: 300px 300px;
    background-position: center;
    background-repeat: no-repeat;
    cursor: grab;
    touch-action: none;
    transition: transform 0.08s linear;
}

.pgt-fragment-piece.pgt-dragging {
    cursor: grabbing;
    z-index: 30 !important;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.6));
}

.pgt-fragment-piece.pgt-snapped {
    cursor: default;
    pointer-events: none;
    transition: transform 0.25s ease;
    z-index: 10;
}

/* ==========================================================================
   Stage 8: Sliding Puzzle (3x3 8-tile)
   ========================================================================== */

.pgt-sliding-grid {
    position: relative;
    width: 300px;
    height: 300px;
    background: #0d0d12;
}

.pgt-sliding-tile {
    position: absolute;
    width: 98px;
    height: 98px;
    cursor: pointer;
    background-size: 300px 300px;
    background-repeat: no-repeat;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.15);
    transition: left 0.18s cubic-bezier(0.2, 0, 0, 1), top 0.18s cubic-bezier(0.2, 0, 0, 1);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.pgt-sliding-tile:hover {
    filter: brightness(1.08);
}

.pgt-sliding-num {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.65);
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 4px;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
}

.pgt-sliding-grid.pgt-sliding-solved .pgt-sliding-num {
    opacity: 0;
}

.pgt-sliding-tile.pgt-tile-solved {
    animation: pgtPopIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ==========================================================================
   Status Notification Modal (Global Overlay)
   ========================================================================== */

.pgt-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: pgtFadeIn 0.3s ease;
}

.pgt-modal-card {
    background: #1e1e24;
    color: #ffffff;
    max-width: 380px;
    width: 100%;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: pgtPopUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pgtPopUp {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.pgt-modal-emoji {
    font-size: 48px;
    margin-bottom: 12px;
}

.pgt-modal-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #ffffff;
}

.pgt-modal-body {
    font-size: 14px;
    color: var(--pgt-muted);
    line-height: 1.4;
    margin-bottom: 20px;
}

.pgt-modal-btn {
    display: inline-block;
    width: 100%;
    padding: 12px 18px;
    background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
    transition: background 0.2s, transform 0.1s;
}

.pgt-modal-btn:hover {
    background: #1e8449;
    color: #ffffff;
}

.pgt-modal-btn:active {
    transform: scale(0.98);
}

/* ==========================================================================
   Order Arrival Override Banner
   ========================================================================== */

.pgt-arrival-banner {
    background: linear-gradient(135deg, #f39c12 0%, #d68910 100%);
    color: #ffffff;
    border-radius: var(--pgt-radius);
    padding: 16px;
    margin: 16px auto;
    max-width: 420px;
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    box-shadow: 0 6px 16px rgba(243, 156, 18, 0.35);
    animation: pgtSlideDown 0.4s ease;
}

/* ==========================================================================
   Mobile Responsive: Fixed Edge-to-Edge Overlay (Header to Bottom)
   ========================================================================== */

@media (max-width: 1180px) {
    body.pgt-locked {
        overflow: hidden !important;
    }

    .pgt-wrapper {
        width: 90%;
        max-width: 90%;
        margin: 15px auto 20px auto;
    }

    .pgt-body.pgt-open {
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        max-width: 100vw;
        height: calc(100vh - 80px);
        height: calc(100dvh - 80px);
        margin: 0;
        border-radius: 0;
        z-index: 90;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding: 12px 16px max(24px, env(safe-area-inset-bottom, 24px)) 16px;
        box-shadow: none;
        animation: pgtMobileFadeIn 0.25s ease-out;
    }

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

    .pgt-body.pgt-open .pgt-header {
        width: 100%;
        max-width: 320px;
        margin-bottom: 8px;
        padding-bottom: 8px;
    }

    .pgt-body.pgt-open .pgt-instructions {
        width: 100%;
        max-width: 320px;
        margin: 0 auto 10px auto;
    }

    .pgt-body.pgt-open .pgt-viewport {
        margin: 0 auto;
        flex-shrink: 0;
    }

    .pgt-body.pgt-open .pgt-footer {
        width: 100%;
        max-width: 320px;
        margin-top: 10px;
        padding-top: 10px;
    }

    .pgt-close-btn {
        font-size: 24px;
        padding: 4px 10px;
    }
}

