/* Modern color palette and variables */
:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4cc9f0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --success-color: #4CAF50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Base styles */
body {
    font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f7fa;
    color: var(--dark-color);
    line-height: 1.6;
}

/* Logo styles */
#logo {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    margin-bottom: 8px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.8), rgba(255,255,255,0));
    gap: 20px; /* space between images */
}

#logo img {
    width: 230px;
    height: auto;
}

/* Table (dice container) styles */
#dice-container {
    margin: 20px auto;
    width: 80%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 1200px;
}

#name-row, #dice-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.dice {
    width: 100px;
    height: 100px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px; /* Adjust font size as needed */
    cursor: pointer;
    transition: transform 1s cubic-bezier(0.55, 0.085, 0.68, 0.53);
}

.name-card {
    background: linear-gradient(145deg, var(--light-color), #ffffff);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    flex: 1;
    min-width: 150px;
    text-align: center;
    font-weight: bold;
}

.dice-card {
    flex: 1;
    min-width: 150px;
    display: flex;
    justify-content: center;
    padding: 10px;
}

/* Input and button styles */
#add-column {
    text-align: center;
    margin-top: 20px;
}

.input-field {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    margin-right: 10px;
    width: 250px;
    font-size: 16px;
    transition: var(--transition);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.input-field:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.3);
    outline: none;
}

.btn {
    padding: 10px 16px;
    background: linear-gradient(145deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: var(--transition);
    box-shadow: var(--box-shadow);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    background: linear-gradient(145deg, var(--secondary-color), var(--primary-color));
}


/* Dice select and label styling */
label[for="dice-type"] {
    display: block;
    text-align: center;
    font-weight: 600;
    font-size: 18px;
    color: var(--dark-color);
    margin: 0px 0 12px; /* Add top margin to give space from element above */
}

select#dice-type {
    display: block;
    margin: 0 auto;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    font-size: 16px;
    border: 1px solid rgba(0, 0, 0, 0.15); /* ADD subtle border for contrast */
    background-color: #fff; /* REMOVE gradient → solid white makes cleaner */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06); /* ADD soft shadow for pop */
    transition: var(--transition);
    cursor: pointer;
    appearance: none; /* clean look */
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 36px; /* space for arrow */
}

select#dice-type:hover {
    background-color: #f9f9f9; /* light hover color */
}

select#dice-type:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.3);
    background-color: #fff;
}


/* Footer styles */
#footer {
    background: linear-gradient(to right, var(--secondary-color), var(--primary-color));
    color: #fff;
    text-align: center;
    padding: 20px;
    position: fixed;
    bottom: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

#footer p {
    margin: 5px 0;
}

.info-widget {
    display: inline-block;
    margin: 0 10px;
    cursor: pointer;
    position: relative;
}

.info-widget:hover {
    color: cadetblue;
}

.info-widget:hover .info-content {
    display: block;
}

.info-content {
    display: none;
    position: absolute;
    background-color: #000000af;
    color: #fff;
    padding: 10px;
    border-radius: 5px;
    width: 300px;
    text-align: justify;
    z-index: 1;
    top: -190px;
    left: 50%;
    transform: translateX(-50%);
}

/* Overlay styles */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
    transition: opacity 0.3s ease;
}

.overlay-content {
    background: linear-gradient(145deg, #ffffff, var(--light-color));
    padding: 35px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    max-height: 80vh; /* ✅ Prevent it from growing too tall */
    overflow-y: auto;  /* ✅ Enable vertical scroll */
    animation: slideIn 0.3s ease-out;
    position: relative; /* Required for close button positioning */
}


@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.overlay-content h2 {
    margin-top: 0;
    font-size: 24px;
}

.overlay-content ul {
    list-style-type: none;
    padding: 0;
}

.overlay-content li {
    margin-bottom: 15px;
    font-size: 18px;
    line-height: 1.5;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 32px;
    color: #4361ee;
    cursor: pointer;
}

#dynamic-table {
    margin: 20px auto;
    width: 80%;
    border-spacing: 10px; /* Adds gap between columns */
    border-collapse: separate;
    /* background-color: #fff; */
    border-radius: 10px;
    overflow: hidden;
    /* box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); */
}

#dynamic-table tr{
    max-width: 80%;
}

#dynamic-table th{
    /* border: 1px solid #ddd; */
    padding: 12px;
    text-align: center;
    font-weight: bold;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

#dynamic-table td {
    /* border: 1px solid #ddd; */
    padding: 12px;
    text-align: center;
}


#dynamic-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin: 30px auto;
    width: 90%;
    max-width: 1000px;
}

.person-card {
    background-color: #ffffff00;
    padding: 16px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
    max-width: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: var(--transition);
}

.name-label {
    font-weight: bold;
    text-align: center;
    margin-bottom: 12px;
    color: var(--dark-color);
}

/* Mobile responsiveness */
@media only screen and (max-width: 600px) {

    #dynamic-table {
        width: 100%;
    }

    #dynamic-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .person-card {
        max-width: 130px;
    }


    #logo {
        flex-direction: column; /* Stack vertically on mobile */
        padding: 10px;
        margin-bottom: 20px;
        gap: 10px;
    }
    
    #logo img {
        width: 180px;
        height: auto;
    }

    .info-content {
        width: 250px;
        left: 50%;
        transform: translateX(-50%);
        top: -200px;
    }

    .info-widget:active .info-content {
        display: block;
    }

    .overlay-content {
        max-width: 90%;
    }

    /* --- Added fix --- */
    #add-column {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .input-field {
        width: 80%;
        margin-bottom: 12px; /* ADD THIS - creates space below input on mobile */
    }

    .btn {
        width: 80%;
    }
}