/* Standard CSS */
:root {
    --color-cyan: #0097a7;
    --color-maroon: #880e4f;
    --color-green: #00c853;
    --color-yellow: #d4e157;
    --bg-color: #ffffff;
    --font-en: 'Inter', sans-serif;
    --font-ar: 'Noto Kufi Arabic', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Allow scroll if needed, but mostly center */
    min-height: 100vh;
    background-color: var(--bg-color);
    font-family: var(--font-en);
    overflow-x: hidden;
}

#app {
    /* Increased max-width for kiosk */
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    padding-bottom: 60px;
    /* More gap on bottom */
    box-sizing: border-box;
    min-height: 100vh;
    gap: 30px;
    /* Add vertical spacing between elements */
}

/* TOP CARD */
.card {
    width: 100%;
    /* Removed border/padding to let header image sit cleanly */
    border-radius: 12px;
    text-align: center;
    margin-top: 20px;
    /* box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); */
}

/* Category Grid Kiosk Scaling */
.category-grid {
    max-width: 900px;
    /* Match items-grid width */
    gap: 40px;
}

.card-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.card-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto;
}

.mini-logo {
    width: 100%;
    height: 100%;
}

.card-footer-text {
    margin-top: 10px;
    font-family: var(--font-ar);
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
}

/* MAIN PUZZLE LOGO */
.puzzle-container {
    margin: auto;
    /* Centers puzzle vertically and horizontally */
    width: 600px;
    height: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
}


.puzzle-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.puzzle-piece {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Default State (End of Animation) */
    opacity: 1;
    transform: translate(0, 0) scale(1);

    transform-box: fill-box;
    transform-origin: center;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), filter 0.3s ease;
    /* Remove 'forwards' so it settles on the default state defined above, allowing hover to override */
    animation: flyIn 2.0s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Allow clicks to pass through to pieces below */
    pointer-events: none;
}

/* Hover effect removed as requested */

/* Click/Active: Press down effect */
.puzzle-piece:active {
    transform: scale(0.95);
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.2));
    transition-duration: 0.1s;
}

/* Clicked State (JS Toggled) */
.puzzle-piece.clicked {
    /* Make the movement more pronounced (1.5x) and scale up */
    transform: translate(calc(var(--tx) * 1.5), calc(var(--ty) * 1.5)) scale(1.15);
    /* Add a significant shadow/glow to show it is selected */
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.3)) brightness(1.1);
    /* Bring to front */
    z-index: 50;
}

/* Intro Animation Classes */
/* Circular motion on page load */
@keyframes flyIn {
    0% {
        transform: rotate(0deg) translate(100px) rotate(0deg) scale(0.5);
        opacity: 0;
    }

    100% {
        transform: rotate(360deg) translate(0) rotate(-360deg) scale(1);
        opacity: 1;
    }
}

/* Stagger animations - all pieces stay centered */
#piece-cyan {
    animation-delay: 0s;
    top: 0;
    left: 0;
    pointer-events: auto;
    clip-path: polygon(0 0, 50% 0, 50% 50%, 0 78%);
}

#piece-maroon {
    animation-delay: 0.15s;
    top: 0;
    left: 0;
    pointer-events: auto;
    clip-path: polygon(22% 0, 100% 0, 100% 50%, 50% 50%);
}

#piece-green {
    animation-delay: 0.3s;
    top: 0;
    left: 0;
    pointer-events: auto;
    clip-path: polygon(0 50%, 50% 50%, 78% 100%, 0 100%);
}

#piece-yellow {
    animation-delay: 0.45s;
    top: 0;
    left: 0;
    pointer-events: auto;
    clip-path: polygon(50% 50%, 100% 28%, 100% 100%, 50% 100%);
}

/* ICONS */
.icon-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    /* In real app, we would use inline paths here too, but emoji is safe fallback */
}


/* FOOTER */
.footer {
    margin-top: auto;
    border-top: 2px solid #eee;
    width: 100%;
    padding-top: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    color: #000;
    padding-bottom: 20px;
}

.footer-text {
    display: flex;
    gap: 15px;
    align-items: center;
}

.footer span.arabic {
    font-family: var(--font-ar);
}

.back-btn {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
}

.back-btn svg {
    width: 48px;
    height: 48px;
    fill: black;
}

/* Home Title Text */
.home-title {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 20px;
}

.title-ar {
    font-family: var(--font-ar);
    font-size: 1.8rem;
    font-weight: 700;
    color: #000;
    margin-bottom: 5px;
}

.title-en {
    font-family: var(--font-en);
    font-size: 1.5rem;
    font-weight: 700;
    color: #000;
}

/* Kiosk Scaling (1080x1920) */
@media (min-width: 1000px) {
    .title-ar {
        font-size: 2.5rem;
    }

    .title-en {
        font-size: 2rem;
    }

    :root {
        font-size: 24px;
        /* Base scale up */
    }

    .card-header {
        font-size: 2rem;
    }

    .card-footer-text {
        font-size: 2.5rem;
    }

    .card-logo {
        width: 150px;
        height: 150px;
    }

    .footer {
        font-size: 1.5rem;
        padding: 30px 0;
    }

    .back-btn svg {
        width: 80px;
        height: 80px;
    }
}

/* Category Grid from style2.css */
.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.category-card {
    background: white;
    border: 1px solid #ccc;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    /* Distribute space evenly */
    padding: 15px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: auto;
    min-height: 350px;
    /* Increased height */
}

.category-card:active {
    transform: scale(0.98);
}

.category-icon {
    width: 100%;
    height: 240px;
    /* Increased icon size */
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
}

.category-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.category-title {
    font-family: var(--font-en);
    font-weight: 700;
    font-size: 1.8rem;
    margin-bottom: 10px;
    text-transform: lowercase;
}

.category-label {
    background: white;
    border: 1px solid #ccc;
    border-radius: 50px;
    padding: 8px 25px;
    width: 100%;
    text-align: center;
    font-family: var(--font-ar);
    font-weight: 700;
    font-size: 1.5rem;
    /* Larger font */
    color: #333;
}

/* Items List Grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 900px;
    grid-auto-rows: 1fr;
    /* Make all rows equal height */
}

.item-card {
    border: 3px solid var(--color-green);
    border-radius: 16px;
    padding: 10px;
    cursor: pointer;
    background: white;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    /* Ensure text cards stack properly */
    justify-content: center;
    align-items: center;
    text-decoration: none;
    color: inherit;
    height: 100%;
    /* Fill the grid cell */
    aspect-ratio: 1/1;
    /* Make them square and uniform */
    overflow: hidden;
    /* Prevent zoomed images from spilling out */
}

.item-card:active {
    transform: scale(0.95);
    background: color-mix(in srgb, var(--color-green) 10%, white);
}

.item-img {
    width: 100%;
    height: 100%;
    /* Force image to fill the available height of the flex container */
    object-fit: cover;
    transform: scale(3.5);
    /* Boosted to remove image-internal whitespace */
}

.item-text {
    flex-direction: column;
    padding: 10px;
    /* Reduced from 20px to prevent cramping */
    background: #fdfdfd;
}

.item-text p {
    font-family: var(--font-ar);
    font-size: 1.1rem;
    line-height: 1.6;
    color: #333;
    direction: rtl;
    text-align: center;
    /* Centered looks better in grid cards */
    width: 100%;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    /* Standard property */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: break-word;
    /* Ensure long words wrap */
}

.item-text p:last-child {
    margin-bottom: 0;
}

/* Kiosk Adjustments for new elements */
@media (min-width: 1000px) {
    .items-grid {
        max-width: 100%;
        /* Full screen width for maximum card size */
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        column-gap: 25px;
        /* Minimal gap to maximize card width */
        row-gap: 8vh;
        /* Separate rows vertically */
        padding: 30px 15px;
        align-content: start;
        margin: 0;
    }

    .item-card {
        border-width: 20px;
        border-radius: 60px;
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
        box-shadow: 0 50px 100px rgba(0, 0, 0, 0.25);
        padding: 0;
        overflow: hidden;
        display: block;
        background: #fff;
    }

    .item-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transform: scale(1.1);
        /* Zoomed out to show more of the drawing */
        display: block;
    }


    .item-text p {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }

    /* Category Grid Kiosk Scaling */
    .category-grid {
        max-width: 900px;
        gap: 40px;
    }

    .category-card {
        border-radius: 30px;
        border-width: 2px;
        min-height: 550px;
        /* Significantly taller */
    }

    .category-icon {
        height: 380px;
        /* Massive icon */
    }

    .category-title {
        font-size: 2.5rem;
    }

    .category-label {
        font-size: 2.5rem;
        /* Big label */
        padding: 15px 30px;
    }
}

/* Thank You Page Styles */
.thank-you-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: white;
    font-family: var(--font-en);
}

.thank-you-title {
    color: var(--color-maroon);
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 50px;
    text-align: center;
}

.thank-you-card {
    border: 1px solid #ccc;
    /* Light border similar to screenshot */
    border-radius: 20px;
    padding: 2px;
    background: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    max-width: 400px;
    width: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.thank-you-card img {
    width: 100%;
    height: auto;
    border-radius: 18px;
    display: block;
}