/**
 * Modal Styles
 *
 * Base styles for all modal dialogs: overlay backdrop, animation
 * keyframes, modal content container, close button, and shared
 * modal section typography used by instructions, about, and options.
 */

/* ========== Modal Overlay ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== Modal Content ========== */
.modal-content {
    background: var(--container-bg);
    border: 1px solid var(--border-default);
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    color: var(--accent);
    margin-bottom: 20px;
    font-size: 1.8em;
    text-align: center;
}

.modal-content h3 {
    color: var(--text-primary);
    margin: 15px 0 10px;
    font-size: 1.2em;
}

/* ========== Modal Close Button ========== */
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2em;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
    transform: scale(1.1);
}

/* ========== Modal Description and Sections ========== */
.modal-description {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.95em;
}

.modal-section {
    margin-bottom: 20px;
}

.modal-section p {
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.modal-section ul {
    list-style: disc;
    margin-left: 25px;
    color: var(--text-secondary);
}

.modal-section ul li {
    line-height: 1.6;
    margin-bottom: 8px;
}

.modal-section strong {
    color: var(--accent);
}

/* ========== Tile Descriptions (Instructions Modal) ========== */
.tile-descriptions {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 8px;
}

.tile-desc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 4px;
    border-bottom: 1px solid var(--border-subtle);
}

.tile-desc-row:last-child {
    border-bottom: none;
}

.tile-desc-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    position: relative;
    border-radius: 4px;
    overflow: hidden;
}

.tile-desc-icon img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Emoji/text tile overlays inside the instructions icon (mirrors .cell .tile-overlay-emoji) */
.tile-desc-icon .tile-overlay-emoji {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    pointer-events: none;
}

.tile-desc-text {
    font-size: 0.9em;
    color: var(--text-secondary);
    line-height: 1.4;
}

.option-item label {
    color: var(--text-secondary);
}

.option-help {
    display: block;
    color: var(--text-muted);
    font-size: 0.85em;
    margin-top: 5px;
}

/* ========== Two-column Options Layout ========== */
.options-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 30px;
    align-items: start;
}

.options-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.options-group-label {
    color: var(--accent);
    font-size: 1em;
    font-weight: bold;
    margin: 0 0 4px;
    padding-bottom: 4px;
}

/* Wide label spans both columns inside a full-width section */
.options-group-label-wide {
    width: 100%;
}

/* Full-width section within the options modal (Localization, Accounts).
 * Top margin creates whitespace separation from the preceding section. */
.options-full-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}

/* Extra whitespace gap before a new logical section (replaces <hr>) */
.options-section-gap {
    margin-top: 28px;
}

/* ========== Responsive Styles ========== */
@media (max-width: 768px) {
    .options-two-col {
        grid-template-columns: 1fr;
    }

    .options-content {
        flex-direction: column;
        align-items: stretch;
    }

    .option-item {
        width: 100%;
    }
}
