/* styles.css */

/* Prevent text selection */
body {
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none;     /* IE 10 and IE 11 */
    user-select: none;         /* Standard syntax */
}

/* Reset and basic styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f4f8;
    color: #333;
    direction: rtl; /* For Hebrew text */
    text-align: center; /* Center all content */
}

h1 {
    font-size: 28px; /* Made title smaller */
    color: #444;
    margin-right: 20px;
}

/* Header Container */
#header-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
}

#logos-container {
    display: flex;
    align-items: center;
}

#logos-container img {
    max-width: 100px; /* Adjusted logo size */
    margin: 0 10px;
}

/* Button Styles */
button {
    padding: 10px 20px;
    font-size: 18px;
    background-color: #4caf50;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin: 20px 5px;
}

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

button:disabled {
    background-color: #9e9e9e;
    cursor: not-allowed;
}

/* Buttons Container */
#buttons-container {
    margin: 20px 0;
}

#buttons-container button {
    padding: 10px 20px;
    font-size: 18px;
    background-color: #2196F3; /* Different color for these buttons */
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin: 5px;
}

#buttons-container button:hover {
    background-color: #1976D2;
}

/* Main Container */
#main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
}

/* Controls Container */
#controls-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
}

/* Number Pool */
#number-pool {
    display: flex;
    justify-content: center;
    flex-wrap: wrap; /* Allow wrapping to next line */
    flex-direction: row;
    align-items: center;
    margin-bottom: 10px;
    max-width: 100%;
}

.number {
    display: inline-block;
    width: 80px;
    height: 80px;
    margin: 5px;
    background-color: #f0f0f0;
    line-height: 80px;
    font-size: 32px;
    font-weight: bold;
    color: #333;
    cursor: grab;
    border: 2px solid #ccc;
    border-radius: 5px;
    transition: transform 0.2s;
}

.number:hover {
    transform: scale(1.05);
    background-color: #e0e0e0;
}

.number.used {
    opacity: 0.5;
    cursor: default;
}

/* Next Puzzle Button - Corrected */
#next-puzzle-button {
    width: 80px;
    height: 80px;
    line-height: 80px;
    font-size: 32px;
    background-color: #ff9800;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin: 5px;
}

#next-puzzle-button:hover {
    background-color: #f57c00;
}

/* Grid Container */
#grid-container {
    display: grid;
    grid-template-columns: 80px repeat(4, 80px);
    grid-template-rows: 80px repeat(4, 80px);
    grid-gap: 5px;
    justify-content: center;
    margin: 0 auto;
}

.grid-cell {
    width: 80px;
    height: 80px;
    border: 1px solid #ccc;
    position: relative;
    background-color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
}

.target-sum {
    font-weight: bold;
    font-size: 32px;
    color: #333;
}

.target-sum.valid {
    color: #4caf50;
}

.smiley {
    font-size: 24px;
    margin-top: 5px;
}

.empty-cell {
    background-color: #fff;
    border: 1px solid #ccc;
}

/* Shape container */
.shape {
    position: relative;
    width: 100%;
    height: 100%;
}

.grid-cell .shape {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Number overlay on top of the image */
.number-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    padding: 2px 5px;
    border-top-left-radius: 5px;
}

/* Feedback Message */
#feedback {
    font-size: 24px;
    margin-top: 20px;
    color: #4caf50;
}

/* Best Scores Section */
#best-scores {
    margin: 20px auto;
    max-width: 600px;
    max-height: 400px;
    overflow-y: auto;
}

#best-scores h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

#scores-table {
    width: 100%;
    border-collapse: collapse;
}

#scores-table th,
#scores-table td {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: center;
}

#scores-table th {
    background-color: #f0f0f0;
    position: sticky;
    top: 0;
    z-index: 1;
}

#scores-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

/* Background image */
body {
    background-image: url('background.png'); /* Replace with your image */
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
}

/* Adjustments for responsiveness */
@media screen and (max-width: 820px) {
    #app {
        width: 100%;
        margin: 0;
        padding: 10px;
    }

    /* Increase grid size on small screens */
    #grid-container {
        grid-template-columns: 1fr repeat(4, 1fr);
        grid-template-rows: 1fr repeat(4, 1fr);
        width: 100%;
        max-width: 500px;
    }

    .grid-cell {
        width: 100%;
        height: 0;
        padding-bottom: 100%; /* Make it a square */
    }

    .target-sum {
        font-size: 36px;
    }

    .smiley {
        font-size: 28px;
    }

    .number {
        width: 80px;
        height: 80px;
        line-height: 80px;
        font-size: 32px;
    }

    /* Arrange number pool in two rows */
    #number-pool {
        flex-wrap: wrap;
        max-width: 100%;
    }

    /* Adjust number size to fill available space */
    #number-pool .number {
        flex: 1 0 21%; /* Adjust percentage to control number of items per row */
        margin: 5px;
        max-width: 80px;
    }

    /* Adjust controls container height */
    #controls-container {
        height: auto;
    }
}



#next-puzzle-button {
    width: 160px;              /* Increased width to comfortably fit the text */
    height: 80px;              /* Keep height consistent with number buttons */
    display: flex;
    align-items: center;       /* Vertically center the text */
    justify-content: center;   /* Horizontally center the text */
    font-size: 20px;           /* Larger font size for better readability */
    background-color: #ff9800;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin: 5px;
    direction: rtl;            /* Ensure correct text direction for Hebrew */
    text-align: center;
    white-space: nowrap;       /* Prevent text from wrapping */
}

