/* ==============================
   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('../images/textures/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 12px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1; /* Base layer */
    transition: all 0.3s ease;
}

#gameCanvas:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

/* Fonts */
body {
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
}

h1, h2, h3, .font-press-start {
    font-family: 'Press Start 2P', cursive;
}

/* ==============================
   Sudoku Grid Styling
   ============================== */
.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 1px;
    background-color: #333;
    padding: 2px;
    border: 2px solid #333;
    border-radius: 4px;
}

.sudoku-cell {
    aspect-ratio: 1;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #333;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
}

.sudoku-cell:nth-child(3n) {
    border-right: 2px solid #333;
}

.sudoku-cell:nth-child(9n) {
    border-right: none;
}

.sudoku-row:nth-child(3n) .sudoku-cell {
    border-bottom: 2px solid #333;
}

.sudoku-cell.selected {
    background-color: #dcfce7;  /* Light green highlight */
}

.sudoku-cell.highlighted {
    background-color: #bbf7d0;  /* Slightly darker green highlight */
}

.sudoku-cell.fixed {
    font-weight: bold;
    color: #000;
}

.sudoku-cell.error {
    color: #f44336;
}

/* Number Pad Styling */
.number-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 16px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-top: 16px;
}

.number-button {
    padding: 12px;
    font-size: 1.2rem;
    background-color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.number-button:hover {
    background-color: #e3f2fd;
}

/* Enhance button feedback */
.number-btn {
    transition: all 0.2s ease;
    background-color: #374151;  /* Darker background */
}

.number-btn:hover {
    background-color: #16a34a;  /* Green hover */
}

.number-btn:active {
    transform: translateY(0);
}

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

/* Add shake animation for wrong moves */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

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

/* Update color scheme */
.bg-gradient-to-br {
    background: linear-gradient(to bottom right, #166534, #22c55e);  /* Green gradient */
}

/* Pencil mode button */
#pencilMode {
    background-color: #16a34a;  /* Default green */
}

#pencilMode:hover {
    background-color: #15803d;  /* Darker green on hover */
}

#pencilMode.active {
    background-color: #15803d;  /* Active state green */
}

/* Pencil mode active state */
#pencilMode.active {
    background-color: #2563eb;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Enhanced Pencil Mode Button */
#pencilMode {
    position: relative;
    min-width: 180px;
    transition: all 0.3s ease;
}

#pencilMode.active {
    background-color: #2563eb;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

#pencilMode.active .pencil-icon {
    transform: rotate(-45deg);
}

#pencilMode.active .pencil-text {
    font-weight: bold;
}

/* Win Screen Overlay */
.win-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.win-screen.active {
    opacity: 1;
}

.win-content {
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.5s ease;
}

.win-screen.active .win-content {
    transform: translateY(0);
}

.win-title {
    font-size: 2.5rem;
    color: #16a34a;  /* Green instead of blue */
    margin-bottom: 1rem;
    font-family: 'Press Start 2P', cursive;
}

.win-stats {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 2rem;
}

/* Game Card Enhancements */
.game-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.difficulty-badge {
    border-radius: 9999px;
    padding: 4px 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
}

.difficulty-easy {
    background-color: #10B981;  /* Green */
    color: white;
}

.difficulty-medium {
    background-color: #F59E0B;  /* Yellow */
    color: white;
}

.difficulty-hard {
    background-color: #EF4444;  /* Red */
    color: white;
}

.play-button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    background-color: #16a34a !important;  /* Green */
}

.play-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background-color: #15803d !important;  /* Darker green */
}

.play-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: 0.5s;
}

.play-button:hover::after {
    left: 100%;
}

/* Game Card Image Container */
.game-card .image-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.game-card img {
    transition: transform 0.3s ease;
}

.game-card:hover img {
    transform: scale(1.05);
}