/* ==============================
   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:#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 */
    max-width: 100%;
    max-height: 600px; /* Limit canvas height */
}

/* 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 .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 */    
    /* Ensure the background covers the entire card */
    background-size: cover;
    background-repeat: no-repeat;
}

/* ============================
   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 */
}

/* ==============================
   Animation Enhancements
   ============================== */

/* Flip Animation */
@keyframes flip {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(180deg);
    }
}

.flip {
    animation: flip 0.6s forwards;
}

/* ==============================
   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;
}

/* 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;
}

/* 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;
}

/* 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;
    }
}

/* 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;
}
    
    .info-title {
        font-size: 1.2rem;
    }
    
    .info-nav__link {
        display: block;
        margin: 0.5rem 0;
    }
}

/* 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;
}

/* ==============================
   Game Container and Canvas Layout
   ============================== */

.game-container {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: auto; /* Remove min-height constraint */
}

.canvas-container {
    flex-grow: 0; /* Don't allow unlimited growth */
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: auto;
    max-height: 650px; /* Constrain container height */
}

/* Ensure canvas doesn't overflow */
#gameCanvas {
    display: block;
    margin: 0 auto;
    position: static; /* Remove absolute positioning */
    width: auto;
    height: auto;
}

/* Control buttons positioning */
.controls-row {
    margin: 20px 0;
    z-index: 10;
    position: relative;
}

/* Content section spacing */
.content-section {
    margin-top: 40px; /* Add space above content */
    position: relative;
    z-index: 5;
}

/* ==============================
   Responsive Adjustments
   ============================== */

@media (max-width: 768px) {
    .canvas-container {
        padding: 5px;
        max-height: 500px;
    }
    
    #gameCanvas {
        max-height: 450px;
    }
    
    .content-section {
        margin-top: 30px;
    }
}

@media (min-width: 1200px) {
    .canvas-container {
        max-height: 700px;
    }
    
    #gameCanvas {
        max-height: 650px;
    }
}

