/* ==============================
   Global Styles
   ============================== */
   * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Prevent touch-based scrolling and pinch-zoom on the game canvas */
#gameCanvas {
    touch-action: none;
    background: url('https://www.transparenttextures.com/patterns/asfalt-light.png') repeat, #228B22;
    background-size: 100px 100px; /* Apply the texture to all screen sizes */
    border-radius: 10px;
    border: 2px solid #ffffff; /* White border for both mobile and desktop */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1; /* Base layer */
}

/* Fonts */
body {
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
}

h1, h2, h3, .font-press-start {
    font-family: 'Press Start 2P', cursive;
}

/* ==============================
   Card Styling with Depth and 3D Hover Animation
   ============================== */

/* Container for the card to provide 3D perspective */
.card-container {
    perspective: 1000px; /* Gives a 3D effect when rotating the card */
    display: inline-block; /* Ensure the card container fits around the card */
}

/* General card styling */
.card {
    width: 60px;
    height: 90px;
    background-color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);  /* Softer white border */
    border-radius: 8px;  /* Slightly more rounded corners */
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.3),           /* Base shadow for depth */
        0 0 10px rgba(255, 255, 255, 0.5),      /* Soft white glow */
        0 0 5px rgba(255, 255, 255, 0.3);       /* Additional subtle glow */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;  /* Smooth transition for all changes */
    position: relative;
    cursor: pointer;
    user-select: none;
    transform-origin: center bottom;
    backdrop-filter: blur(5px);  /* Adds a slight blur effect behind the card */
}

/* Hover effect for cards */
.card:hover {
    transform: translateY(-10px) rotateY(5deg) rotateX(5deg) scale(1.05); /* 3D transformation on hover */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4); /* Deeper shadow for hover effect */
}

/* Flip Animation */
.flip-card {
    transform-style: preserve-3d;
    transition: transform 0.6s; /* Smooth flip */
    position: relative;
    width: 100%;
    height: 100%;
}

.flip-card.flipped {
    transform: rotateY(180deg); /* Rotate 180 degrees for the flip effect */
}

.flip-card .front, .flip-card .back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden; /* Hide the back face when flipped */
    border-radius: 4px;
}

.flip-card .front {
    /* Front face styling */
}

.flip-card .back {
    transform: rotateY(180deg); /* Back face starts rotated */
    /* Back face styling */
}

/* ==============================
   Specific Design for Foundation Cards
   ============================== */
.foundation .card {
    border: 2px solid #FFD700; /* Gold border to make it stand out */
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.3), 0 3px 6px rgba(0, 0, 0, 0.15);
    z-index: 3; /* Above other cards */
    
    /* New styles for background gradients */
    background: linear-gradient(135deg, #f9d423, #ff4e50); /* Example gradient */
    /* You can customize the colors as per your preference */
    
    /* Optional: Add a subtle pattern overlay for added texture */
    /* background-image: url('path-to-your-pattern.png'), linear-gradient(135deg, #f9d423, #ff4e50);
       background-blend-mode: overlay; */
    
    /* Ensure the background covers the entire card */
    background-size: cover;
    background-repeat: no-repeat;
}

/* ==============================
   Unique Backgrounds for Each Foundation Pile
   ============================== */

/* Foundation Pile 1 - Hearts */
.foundation .card:nth-child(1) {
    background: linear-gradient(135deg, #ff9a9e, #fad0c4); /* Soft pink gradient */
}

/* Foundation Pile 2 - Diamonds */
.foundation .card:nth-child(2) {
    background: linear-gradient(135deg, #a18cd1, #fbc2eb); /* Purple-pink gradient */
}

/* Foundation Pile 3 - Clubs */
.foundation .card:nth-child(3) {
    background: linear-gradient(135deg, #89f7fe, #66a6ff); /* Blue gradient */
}

/* Foundation Pile 4 - Spades */
.foundation .card:nth-child(4) {
    background: linear-gradient(135deg, #f093fb, #f5576c); /* Pink-red gradient */
}

/* ============================
   Foundation Highlight on Drop
   ============================ */
@keyframes highlightDrop {
    0% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
        transform: scale(1.1);
    }
    100% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
        transform: scale(1);
    }
}

.foundation .card-dropped {
    animation: highlightDrop 0.5s ease-out; /* Applies the animation when a card is dropped */
}

/* ==============================
   Canvas and Card Adjustments for Mobile
   ============================== */
@media (max-width: 768px) {
    #gameCanvas {
        width: 100%;
        height: auto;
        max-width: 375px; /* General mobile */
        max-height: 667px;
        position: relative;
    }

    .stockpile {
        position: absolute;
        left: 10px;
        top: 20px;
    }

    .waste {
        position: absolute;
        left: 90px;
        top: 20px;
    }

    .foundation {
        position: absolute;
        right: 10px;
        top: 20px;
    }

    .card {
        width: 45px;
        height: 65px;
    }

    .tableau {
        margin-top: 150px;
        gap: 5px;
    }
}

/* iPhone SE adjustments */
@media screen and (max-width: 320px) and (max-height: 568px) {
    #gameCanvas {
        max-width: 320px;
        max-height: 568px;
    }

    .stockpile {
        left: 5px;
        top: 15px;
    }

    .waste {
        left: 80px; /* Reduce the spacing to fit screen */
    }

    .foundation {
        right: 5px; /* Adjust right alignment */
        top: 15px;
    }

    .card {
        width: 40px;
        height: 60px;
    }

    .tableau {
        margin-top: 130px;
        gap: 4px;
    }
}

/* iPhone 12 Pro adjustments */
@media screen and (min-width: 390px) and (max-width: 430px) {
    #gameCanvas {
        max-width: 390px;
        max-height: 844px; /* iPhone 12 Pro dimensions */
    }

    .stockpile {
        left: 15px;
        top: 25px;
    }

    .waste {
        left: 110px; /* Adjust for larger screen */
    }

    .foundation {
        right: 15px;
        top: 25px;
    }

    .card {
        width: 50px;
        height: 70px;
    }

    .tableau {
        margin-top: 180px;
        gap: 6px;
    }
}

/* Samsung Galaxy S8 adjustments */
@media screen and (min-width: 360px) and (max-width: 412px) {
    #gameCanvas {
        max-width: 360px;
        max-height: 740px; /* Galaxy S8 screen size */
    }

    .stockpile {
        left: 12px;
        top: 18px;
    }

    .waste {
        left: 95px; /* Adjust for screen */
    }

    .foundation {
        right: 12px;
        top: 18px;
    }

    .card {
        width: 45px;
        height: 65px;
    }

    .tableau {
        margin-top: 160px;
        gap: 5px;
    }
}

/* ==============================
   Animation Enhancements
   ============================== */

/* Flip Animation */
@keyframes flip {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(180deg);
    }
}

.flip {
    animation: flip 0.6s forwards;
}

/* Pulse Animation for Foundation Cards */
@keyframes pulse {
    0% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    }
    50% {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.8);
    }
    100% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    }
}

.pulse {
    animation: pulse 1.5s infinite;
}

/* ==============================
   Additional Adjustments
   ============================== */

/* Highlight card being dragged */
.dragging {
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.4);
    transform: scale(1.1);
    z-index: 5; /* Above all other elements */
}

/* Highlight valid drop zones */
.valid-drop {
    border: 2px dashed #00ff00;
}

/* ==============================
   Pop-up Message Styles
   ============================== */
.popup {
    background-color: #ffffff; /* White background */
    color: #000000; /* Black text */
    border: 1px solid #ccc; /* Light gray border */
    padding: 20px; /* Space inside the popup */
    border-radius: 8px; /* Rounded corners */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); /* Shadow for depth */
    position: fixed; /* Fixed position on the screen */
    top: 50%; /* Center vertically */
    left: 50%; /* Center horizontally */
    transform: translate(-50%, -50%); /* Adjust to perfectly center */
    z-index: 1000; /* Ensure it's above other elements */
    /* display: none; */ /* Removed to prevent conflict */
    max-width: 90%; /* Responsive width */
    text-align: center; /* Centered text */
}

/* OK Button Styles */
.popup-button {
    margin-top: 20px; /* Space above the button */
    padding: 10px 20px; /* Button padding */
    background-color: #4CAF50; /* Green background */
    color: white; /* White text */
    border: none; /* No border */
    border-radius: 5px; /* Rounded corners */
    cursor: pointer; /* Pointer cursor on hover */
    font-size: 16px; /* Font size */
}

.popup-button:hover {
    background-color: #45a049; /* Darker green on hover */
}

/* Hidden Class to Hide Elements */
.hidden {
    display: none; /* Completely hides the element */
}

/* ==============================
   Desktop-Specific Styles
   ============================== */

@media (min-width: 768px) {
    /* Position the controlButtons container above the game canvas */
    .game-container {
        position: relative; /* Establish a positioning context */
    }

    #controlButtons {
        position: absolute; /* Position absolutely within the game-container */
        top: 10px; /* Adjust this value to move buttons higher or lower */
        right: 50%; /* Center horizontally */
        transform: translateX(50%); /* Center alignment */
    }

    #controlButtons {
        margin-bottom: 0; /* Remove bottom margin */
    }
}


/* Buttons should stay visible below the canvas */
#controlButtons {
    margin-top: 10px;  /* Ensure some space between the canvas and buttons */
    position: relative;
    z-index: 2;  /* Keep them above the canvas */
    display: flex;
    justify-content: center;  /* Center buttons horizontally */
}

/* Adjust button size for desktop */
#controlButtons button {
    font-size: 16px;  /* Increase button font size */
    padding: 10px 20px;  /* Adjust padding for bigger buttons */
}

/* On mobile, make sure buttons are accessible and positioned well */
@media (max-width: 768px) {
    #controlButtons {
        position: static;  /* Allow normal flow in mobile layout */
        margin-top: 20px;  /* Add spacing on mobile as well */
    }

    #controlButtons button {
        font-size: 14px;  /* Smaller buttons on mobile */
        padding: 8px 16px;
    }
}

/* Game Stats Styling */
#gameStats {
    display: flex;
    justify-content: center;
    gap: 20px;
}

#timerDisplay,
#movesDisplay,
#scoreDisplay,
#highScoreDisplay {
    font-family: 'Roboto', sans-serif !important;
    font-size: 16px !important;
    color: white !important;
    font-weight: bold !important;
}

/* Game Title */
.game-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 20px;
    color: #fff;
    text-align: center;
    margin: 5px 0;
    text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.3);
}


/* Adjust Game Canvas */
.canvas-container {
    flex-grow: 1;
    width: 100%;
    max-width: 1000px; /* Max width for desktop canvas */
    height: auto;
    position: relative; /* Allows for control buttons to be positioned relative */
}

#statsOverlay {
    z-index: 9999;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Header and Stats Styling */
.solitaire-header {
    text-align: center;
    margin: 5px 0;
    padding: 0;
    font-size: 24px;
    font-family: 'Press Start 2P', cursive;
    color: #000;
    text-shadow: 2px 2px 0px rgba(255, 255, 255, 0.5);
}

/* Game Stats Container */
#gameStats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 5px 0;
    margin: 0;
    border-radius: 4px;
}

/* Individual Stat Items */
#timerDisplay,
#movesDisplay,
#scoreDisplay,
#highScoreDisplay {
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    color: #000;
    padding: 5px;
    margin: 0;
    text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.5);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .solitaire-header {
        font-size: 20px;
    }
    
    #timerDisplay,
    #movesDisplay,
    #scoreDisplay,
    #highScoreDisplay {
        font-size: 10px;
    }
}
/* Override Game Stats Styling */
#gameStats div,
#timerDisplay,
#movesDisplay,
#scoreDisplay,
#highScoreDisplay {
    font-family: 'Roboto', sans-serif !important;
    font-size: 18px !important;
    color: white !important;
    font-weight: bold !important;
    text-shadow: none !important;
}

.achievement-item {
    transform: translateY(0);
    transition: transform 0.2s ease-in-out;
}

.achievement-item:hover {
    transform: translateY(-2px);
}

.achievement-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slideIn 0.5s ease-out;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.achievement-icon {
    font-size: 24px;
}

.achievement-text {
    display: flex;
    flex-direction: column;
}

.achievement-title {
    font-size: 12px;
    color: #ffd700;
}

.achievement-name {
    font-size: 16px;
    font-weight: bold;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Achievement Card Styles */
/* Achievement card base styles */
.achievement-card {
    transition: all 0.3s ease;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
}

/* Unlocked achievement styles */
.achievement-earned {
    background: linear-gradient(to right, #dcfce7, #bbf7d0);
    border: 2px solid #4ade80;
    transform: scale(1);
    opacity: 1;
}

.achievement-earned:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(74, 222, 128, 0.2);
}

/* Locked achievement styles */
.achievement-locked {
    background: #f3f4f6;
    border: 2px solid #d1d5db;
    opacity: 0.6;
    filter: grayscale(1);
}

.achievement-locked:hover {
    opacity: 0.8;
    transform: translateY(-2px);
}

/* Progress Bar Animation */
@keyframes progressFill {
    from { width: 0; }
    to { width: var(--progress-width); }
}

#progressBar {
    animation: progressFill 1s ease-out forwards;
}

/* Achievement status indicators */
.achievement-earned {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
}

.achievement-locked {
    background-color: rgba(229, 231, 235, 0.5);
    border-color: rgba(229, 231, 235, 0.8);
}

#achievementsOverlay {
    /* Keep existing styles and add/update these */
    overflow: hidden; /* Hide overflow on the overlay */
}

#achievementsList {
    /* Add these new styles */
    max-height: 70vh; /* Take up 70% of the viewport height */
    overflow-y: auto; /* Enable vertical scrolling */
    padding-right: 16px; /* Add padding for scrollbar */
    scroll-behavior: smooth; /* Enable smooth scrolling */
}

/* Add styles for the scrollbar */
#achievementsList::-webkit-scrollbar {
    width: 8px;
}

#achievementsList::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#achievementsList::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#achievementsList::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Dropdown menu */
.dropdown-menu {
    display: none;
    min-width: 180px;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

/* Smooth animation for arrow */
.dropdown button svg {
    transition: transform 0.2s ease-in-out;
}

.dropdown:hover button svg {
    transform: rotate(180deg);
}

/* Active state for current game type */
.dropdown-menu a.active {
    background-color: #f3f4f6;
}

/* Ensure dropdown is always on top */
.dropdown {
    position: relative;
    z-index: 50;
}

/* Add to style.css */

/* Info Pages Specific Styles */
.info-page {
    min-height: 100vh;
    background: url('https://www.transparenttextures.com/patterns/asfalt-light.png') repeat, #228B22;
    background-size: 100px 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.info-header {
    width: 100%;
    max-width: 800px;
    margin-bottom: 2rem;
}

.info-nav {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.info-nav__link {
    color: white;
    text-decoration: none;
    font-family: 'Press Start 2P', cursive;
    padding: 0.5rem 1rem;
    margin: 0 0.5rem;
    transition: all 0.3s ease;
}

.info-title {
    font-family: 'Press Start 2P', cursive;
    color: white;
    text-align: center;
    margin: 2rem 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.info-content {
    width: 90%;
    max-width: 800px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    padding: 2rem;
    margin-bottom: 2rem;
}

.info-section__title {
    font-family: 'Press Start 2P', cursive;
    color: #228B22;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.info-section__text {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: #333;
    margin-bottom: 1.5rem;
}

.info-section__list {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: #333;
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-footer {
    width: 100%;
    text-align: center;
    margin-top: auto;
    padding: 2rem 0;
}

.info-footer__nav {
    margin-bottom: 1rem;
}

.info-footer__link {
    color: white;
    text-decoration: none;
    margin: 0 0.5rem;
}

.info-footer__copy {
    color: white;
    font-family: 'Roboto', sans-serif;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .info-content {
        width: 95%;
        padding: 1rem;
    }
    
    .info-title {
        font-size: 1.2rem;
    }
    
    .info-nav__link {
        display: block;
        margin: 0.5rem 0;
    }
}

/* Add to style.css */

/* Contact Page Specific Styles */
.contact-page .info-section {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
}

.contact-page .info-section__text {
    font-family: 'Roboto', sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
    margin-bottom: 3rem;
    text-align: center;
}

/* Reset alignment for other pages */
.info-section {
    text-align: left;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.info-section__text {
    font-family: 'Roboto', sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
    margin-bottom: 2rem;
    text-align: left;
}

.share-button {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: #3182ce; /* Tailwind's bg-blue-600 */
    color: #ffffff;
    border: none;
    border-radius: 0.5rem; /* Tailwind's rounded-lg */
    cursor: pointer;
    transition: background-color 0.3s;
}

.share-button:hover {
    background-color: #2c5282; /* Tailwind's hover:bg-blue-500 */
}
/* Remove box-shadow from the Facebook share button */
#facebookShareButton {
    box-shadow: none !important;
}