﻿/* General styling for board cells */
.cell {
    width: 100%;
    aspect-ratio: 1;
    position: relative;
    border: 1px solid #ccc;
    box-sizing: border-box;
    overflow: hidden;
}

.points-display {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.8em;
    color: #666;
}

.action-button {
    margin: 5px;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
}

    .action-button:hover {
        background-color: #45a049;
    }

.tile-container {
    position: relative;
    display: inline-block;
}

.tile-points {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.8em;
    color: #666;
}

.cell input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    text-align: center;
    font-size: 1.3rem;
    font-family: Arial, sans-serif;
    border: none;
    background: transparent;
    outline: none;
    box-sizing: border-box;
    color: inherit;
}

    .cell input.filled {
        background-color: gray;
        color: black;
        font-weight: bold;
        text-transform: uppercase;
    }

.popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.popup-content {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    width: 300px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#shareableUrl {
    width: 100%;
    margin-bottom: 10px;
    padding: 5px;
    font-size: 1em;
    text-align: center;
}


/* Styling for the "Your Tiles" section */
#your-tiles-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
    max-width: 100%;
    margin: 20px auto;
    flex-wrap: wrap;
}

.game-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    max-width: 650px;
    margin: 0 auto;
}

.suggestions-container {
    width: 100%;
    max-width: 300px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 5px;
    margin: 0 auto;
}

.suggestions-list {
    max-height: 400px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 8px 12px;
    margin: 5px 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

    .suggestion-item:hover {
        background: #e9e9e9;
    }

    .suggestion-item.selected {
        background: #007bff;
        color: white;
    }

.score-display {
    font-size: 1.2em;
    margin: 10px 0;
    font-weight: bold;
}

/* Loading screen styling */
#loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin: 0 auto 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Tile styling */
.tile {
    width: 60px;
    height: 60px;
    min-width: 44px;
    min-height: 44px;
    border: 2px solid #333;
    background: #f9e4b7; /* Light wood-like background */
    font-size: 2rem;
    text-align: center;
    font-weight: bold;
    text-transform: uppercase;
    font-family: Arial, sans-serif;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
    border-radius: 5px; /* Slightly rounded corners */
    position: relative;
    transition: all 0.3s ease;
}

    /* Tile number score */
    .tile::after {
        content: attr(data-score); /* Use the `data-score` attribute to display the letter score */
        position: absolute;
        bottom: 5px;
        right: 5px;
        font-size: 0.8rem;
        color: #333;
        font-weight: bold;
    }

    /* Interaction states */
    .tile:focus {
        outline: none;
        background-color: #ebd8a6;
    }

    .tile:hover {
        background-color: #ebd8a6; /* Lighter wood-like hover effect */
        cursor: pointer;
    }

/* Board container */
#board {
    display: grid;
    grid-template-columns: repeat(15, 1fr); /* Maintain 15 columns */
    grid-auto-rows: 1fr;
    width: 100%; /* Full width of the screen */
    max-width: 100%; /* Ensure it doesn't exceed the screen */
    margin: 20px auto;
    gap: 1px; /* Optional spacing between cells */
    position: relative;
    isolation: isolate;
    --board-overlay-image: none;
    --board-overlay-opacity: 0;
}

#board::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--board-overlay-image);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    opacity: var(--board-overlay-opacity);
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 0;
}

    #board .cell {
        position: relative;
        width: 100%;
        aspect-ratio: 1; /* Maintain square shape */
        border: 1px solid #aaa;
        background-color: transparent; /* Empty cells remain transparent */
        box-sizing: border-box;
        z-index: 1;
    }

        /* Styling for filled cells */
        #board .cell .filled {
            background-color: #f9e4b7; /* Light wood-like background */
            color: #333;
            font-size: 2rem;
            font-weight: bold;
            text-transform: uppercase;
            font-family: Arial, sans-serif;
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 2px solid #333; /* Add a border to filled cells */
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Shadow for a lifted effect */
            border-radius: 5px; /* Rounded corners */
            position: relative;
        }

            /* Display letter score for filled cells */
            #board .cell .filled::after {
                content: attr(data-score); /* Use the data-score attribute for the letter score */
                position: absolute;
                bottom: 5px;
                right: 5px;
                font-size: 0.8rem;
                color: #555;
                font-weight: bold;
            }
.toolbar {
    width: 100%;
    background-color: #f3f4f6;
    padding: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.toolbar-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 800px;
    margin: 0 auto;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
}

.btn-blue {
    background-color: #3b82f6;
}

    .btn-blue:hover {
        background-color: #2563eb;
    }

.btn-cyan {
    background-color: #06b6d4;
}

    .btn-cyan:hover {
        background-color: #0891b2;
    }

.is-hidden {
    display: none !important;
}

.btn-yellow {
    background-color: #f59e0b;
}

    .btn-yellow:hover {
        background-color: #d97706;
    }

/* Mobile adjustments */
@media (max-width: 640px) {
    /* FIXED: Increase toolbar button tap targets */
    .toolbar-btn {
        padding: 12px 16px;
        font-size: 16px;
        min-height: 44px;
    }

    .hide-mobile {
        display: none;
    }

    /* Make tiles container more mobile friendly */
    .tiles-container {
        padding: 15px;
    }

    .tile {
        width: 50px;
        height: 50px;
        font-size: 1.6rem;
    }

    /* Make board cells easier to tap on mobile */
    #board {
        touch-action: pinch-zoom;
        user-select: none;
        -webkit-user-select: none;
    }

    #board .cell input {
        font-size: 1rem;
        /* Prevent zoom on input focus */
        font-size: 16px !important;
    }

    /* Move suggestions to bottom on mobile for easier access */
    .suggestions-container {
        position: sticky;
        bottom: 0;
        max-width: 100%;
        margin-top: 20px;
        z-index: 50;
    }

    .suggestions-list {
        max-height: 250px;
    }

    .suggestion-item {
        padding: 12px 16px;
        font-size: 1rem;
        min-height: 44px;
    }
}
h3,h2,h4{
    font-weight:bold;
    margin-top:20px;
    margin-bottom:12px;
}
/* Ensure buttons stay touch-friendly on small screens */
@media (max-width: 360px) {
    .toolbar-content {
        gap: 6px;
        flex-direction: column;
    }

    /* FIXED: Maintain proper tap targets even on very small screens */
    .toolbar-btn {
        padding: 12px 14px;
        min-height: 44px;
        width: 100%;
    }

    .tile {
        width: 44px;
        height: 44px;
        font-size: 1.4rem;
    }

    /* Allow horizontal scroll for board on very small screens */
    .game-container {
        overflow-x: auto;
    }

    #board {
        min-width: 320px;
    }
}
/* Responsive adjustments */
@media (max-width: 768px) {
    #board .cell .filled {
        font-size: 1rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    }
}

@media (max-width: 480px) {
    #board .cell .filled {
        font-size: 1.8rem;
        font-weight: bold;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        border:none;
        border-radius:0;
    }
 
}


/* Special tiles */
.ql {
    background: url('../images/l4.png') no-repeat center center;
    background-size: contain;
}

.tw {
    background: url('../images/w3.png') no-repeat center center;
    background-size: contain;
}

.dw {
    background: url('../images/w2.png') no-repeat center center;
    background-size: contain;
}

.tl {
    background: url('../images/l3.png') no-repeat center center;
    background-size: contain;
}

.dl {
    background: url('../images/l2.png') no-repeat center center;
    background-size: contain;
}

.start {
    background: url('../images/start.png') no-repeat center center;
    background-size: contain;
}

/* Responsive styling for smaller screens */
@media (max-width: 768px) {
    #board {
        grid-template-columns: repeat(15, 1fr); /* Maintain 15 columns */
    }

        #board .cell {
            aspect-ratio: 1; /* Keep squares */
            border-width: 0.5px; /* Thinner borders for smaller screens */
        }

    .tile {
        width: calc(100vw / 16); /* Dynamically calculate tile size */
        height: calc(100vw / 16); /* Same as width to ensure square */
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .col-md-8, .col-sm-8 {
        padding: 0;
    }

    .featured {
        padding: 0;
        border: none;
    }

    #board {
        grid-template-columns: repeat(15, 1fr); /* Maintain 15 columns */
    }

        #board .cell {
            aspect-ratio: 1; /* Square cells */
            border-width: 0.25px;
        }

    .tile {
        width: calc(100vw / 9); /* Make tiles smaller for very narrow screens */
        height: calc(100vw / 9);
        font-size: 1.2rem;
    }

    @media (min-width: 768px) {
        .tile, #board .cell.filled {
            font-size: 2.5rem; /* Bigger font for larger screens */
        }
    }

    /* Smaller font for mobile */
    @media (max-width: 480px) {
        .tile, #board .cell.filled {
            font-size: 3.0rem; /* Slightly smaller font for mobile */
        }

        .cell .points-display {
          display:none;
        }
    }
}
