/* home-game-details.css */

/* ========================================
   GAME DETAILS
   ======================================== */

.game_details_grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.detail_section h3 {
    font-family: 'Philosopher', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid hsla(210, 30%, 35%, 0.3);
}

.detail_row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    padding: 0.4rem 0;
    color: var(--text-secondary);
}

.detail_label {
    font-weight: 600;
    color: var(--text-muted);
}

/* ========================================
   PLAYERS SECTION
   ======================================== */

.players_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.players_header h3 {
    margin-bottom: 0;
}

.player_actions {
    display: flex;
    gap: 0.5rem;
}

.players_list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.player_item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    background: hsla(220, 20%, 6%, 0.5);
    border: 1px solid hsla(210, 30%, 35%, 0.3);
    border-radius: 8px;
}

.player_icon {
    font-size: 1.2rem;
}

.player_info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-secondary);
}

.player_name {
    font-weight: 600;
}

.ai_badge {
    background: hsla(210, 15%, 50%, 0.2);
    color: var(--text-muted);
    border: 1px solid var(--text-muted);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.nation_badge {
    color: var(--text-primary);
    text-transform: capitalize;
}

.nation_badge.nation_missing {
    background: hsla(0, 75%, 55%, 0.15);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

/* Nation color dots in player list - TODO: replace with nation icon */
.nation-colors {
    display: inline-flex;
    gap: 2px;
    margin-right: 0.4rem;
    vertical-align: middle;
}

.nation-colors .color-dot-small {
    width: 10px;
    height: 10px;
}

.no_players {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ========================================
   ADMIN SECTION
   ======================================== */

.admin_section {
    border-top: 2px solid hsla(210, 30%, 35%, 0.3);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.admin_section h3 {
    font-family: 'Philosopher', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-red);
    margin-bottom: 1rem;
}

.admin_actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.admin_actions_grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.action_group {
    background: rgba(40, 40, 45, 0.3);
    border: 1px solid rgba(100, 100, 120, 0.2);
    border-radius: 8px;
    padding: 1rem;
}

.action_group h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: rgba(200, 200, 210, 0.9);
    border-bottom: 1px solid rgba(100, 100, 120, 0.2);
    padding-bottom: 0.5rem;
}

.warning-text {
    padding: 0.8rem;
    background: hsla(45, 85%, 60%, 0.15);
    color: var(--accent-gold);
    border: 1px solid var(--accent-gold);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

/* ========================================
   NATION SELECTOR MODAL
   ======================================== */

.nation-modal {
    max-width: 1600px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nation-modal .modal-header,
.nation-modal .modal-actions {
    flex-shrink: 0;
}

.nation-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.nation-selection-body {
    display: flex;
    gap: 2rem;
    min-height: 500px;
}

/* Nations Menu (Left Side) */
.nations-menu {
    width: 250px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    padding-right: 1rem;
    border-right: 2px solid hsla(210, 30%, 35%, 0.3);
}

.nation-menu-item {
    padding: 1rem;
    background: rgba(30, 35, 45, 0.4);
    border: 2px solid rgba(100, 110, 130, 0.2);
    border-left: 4px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nation-menu-item:hover {
    background: rgba(40, 45, 55, 0.5);
    border-color: rgba(100, 150, 200, 0.3);
    transform: translateX(5px);
}

.nation-menu-item.selected {
    background: rgba(50, 60, 80, 0.4);
    border-right-color: rgba(100, 150, 200, 0.4);
}

.nation-menu-name {
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Philosopher', sans-serif;
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.nation-menu-name .taken-indicator {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.7;
    margin-left: 0.5rem;
}

.nation-menu-item.taken {
    text-decoration: line-through;
    text-decoration-color: hsl(0, 50%, 50%);
}

.nation-menu-colors {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.color-dot-small {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Nation Details (Right Side) */
.nation-details {
    flex: 1;
    overflow-y: auto;
    padding-left: 1rem;
}

.nation-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-text {
    color: var(--text-muted);
    font-style: italic;
    font-size: 1.1rem;
}

.nation-detail-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.nation-detail-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid hsla(210, 30%, 35%, 0.3);
}

.nation-detail-name {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Philosopher', sans-serif;
    margin: 0;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.nation-detail-title {
    font-size: 1.1rem;
    font-style: italic;
    font-weight: 300;
}

.nation-detail-colors {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    padding: 0.5rem 0;
}

.color-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.nation-detail-description {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 1rem;
    background: rgba(30, 35, 45, 0.3);
    border-left: 3px solid var(--accent-cyan);
    border-radius: 4px;
}

.nation-detail-traits {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.nation-detail-traits h4 {
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Philosopher', sans-serif;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.trait-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.trait-item {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
    background: rgba(30, 35, 45, 0.2);
    border-radius: 4px;
}

.trait-item:before {
    content: "▸";
    position: absolute;
    left: 0.5rem;
    color: var(--accent-cyan);
    font-weight: 700;
}

/* ========================================
   NATION UNITS SECTION
   ======================================== */

.nation-detail-units {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nation-detail-units h4 {
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Philosopher', sans-serif;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nation-units-section {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.nation-units-subtitle {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-blue);
    margin: 0;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid hsla(210, 30%, 35%, 0.2);
}

.nation-units-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    padding: 0.5rem 0;
}

.nation-unit-card {
    position: relative;
    background: rgba(30, 35, 45, 0.4);
    border: 2px solid rgba(100, 110, 130, 0.2);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    -webkit-touch-callout: none;
}

.nation-unit-card,
.nation-unit-card * {
    -webkit-user-select: none;
    user-select: none;
}

.nation-unit-card:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 12px rgba(100, 150, 200, 0.3);
    z-index: 10;
}

.nation-unit-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.nation-unit-name {
    padding: 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-primary);
    background: rgba(20, 25, 35, 0.6);
    border-top: 1px solid rgba(100, 110, 130, 0.2);
    line-height: 1.2;
    min-height: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hero cards - golden border */
.nation-unit-card.hero-card {
    /* border-color: hsla(45, 80%, 50%, 0.4); */
}

.nation-unit-card.hero-card:hover {
    border-color: hsla(45, 80%, 50%, 0.8);
    box-shadow: 0 4px 12px hsla(45, 80%, 50%, 0.3);
}

/* ========================================
   CLIMATE PREFERENCE SECTION
   ======================================== */

.nation-detail-temperature {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.nation-detail-temperature h4 {
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Philosopher', sans-serif;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.temperature-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    background: rgba(30, 35, 45, 0.3);
    border-radius: 6px;
    border-left: 3px solid var(--accent-cyan);
}

.temperature-icon {
    font-size: 1.3rem;
}

.temperature-value {
    font-weight: 600;
    color: var(--text-primary);
}

.temperature-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========================================
   STARTING SITES SECTION
   ======================================== */

.nation-detail-sites {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.nation-detail-sites h4 {
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Philosopher', sans-serif;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nation-sites-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.nation-site-item {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    background: rgba(30, 35, 45, 0.3);
    border-radius: 6px;
    border-left: 3px solid;  /* Color set via inline style based on magic path */
}

.site-emoji {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.site-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.site-name {
    font-weight: 600;
    font-size: 0.95rem;
    /* Color set via inline style based on magic path */
}

.site-effects {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.site-recruits {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

/* ========================================
   AI NATION SELECTION
   ======================================== */

.ai-nation-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.ai-nation-option {
    padding: 1rem;
    background: rgba(30, 35, 45, 0.4);
    border: 2px solid rgba(100, 110, 130, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.ai-nation-option:hover {
    background: rgba(40, 45, 55, 0.5);
    border-color: rgba(100, 150, 200, 0.3);
    transform: translateY(-2px);
}

.ai-nation-option.selected {
    background: rgba(50, 60, 80, 0.6);
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(100, 150, 200, 0.3);
}

.option-icon {
    font-size: 2rem;
}

.option-colors {
    display: flex;
    gap: 0.4rem;
}

.option-name {
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Philosopher', sans-serif;
    color: var(--text-primary);
}

.option-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ========================================
   AI PERSONALITY SELECTION
   ======================================== */

.ai-personality-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.ai-personality-option {
    padding: 1rem;
    background: rgba(30, 35, 45, 0.4);
    border: 2px solid rgba(100, 110, 130, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.ai-personality-option:hover {
    background: rgba(40, 45, 55, 0.5);
    border-color: rgba(100, 150, 200, 0.3);
    transform: translateY(-2px);
}

.ai-personality-option.selected {
    background: rgba(50, 60, 80, 0.6);
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(100, 150, 200, 0.3);
}

/* ========================================
   RESPONSIVE DESIGN - TABLET (768px)
   ======================================== */

@media only screen and (max-width: 768px) {
    .game_details_grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .detail_section {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem 1rem;
    }

    .detail_section h3 {
        grid-column: 1 / -1;
    }

    .players_header,
    .players_list {
        grid-column: 1 / -1;
    }

    .players_list {
        gap: 0.4rem;
    }

    .detail_row {
        margin-bottom: 0;
        padding: 0.2rem 0;
        flex-direction: column;
        gap: 0;
    }

    .detail_row_date {
        display: none;
    }

    .map-seed {
        display: none;
    }

    .admin_actions_grid {
        grid-template-columns: 1fr;
    }

    .ai-personality-options {
        grid-template-columns: 1fr;
    }

    /* Nation selection modal - full screen with iOS safe area */
    .nation-modal {
        max-width: 100vw;
        max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        border-radius: 0;
        margin-top: env(safe-area-inset-top);
    }

    .nation-modal .modal-actions {
        flex-direction: row-reverse;
        justify-content: space-between;
    }

    .nation-modal .modal-actions .btn {
        flex: 1;
    }

    .nation-selection-body {
        flex-direction: column;
        gap: 0;
        min-height: 0;
    }

    /* Nations menu becomes a 3-column compact grid */
    .nations-menu {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.3rem;
        overflow-y: visible;
        overflow-x: visible;
        padding-right: 0;
        padding-bottom: 0.75rem;
        margin-bottom: 0.75rem;
        border-right: none;
        border-bottom: 2px solid hsla(210, 30%, 35%, 0.3);
        flex-shrink: 0;
    }

    .nation-menu-item {
        min-width: 0;
        padding: 0.4rem 0.5rem;
        border-left: 3px solid transparent;
        border-radius: 6px;
        gap: 0.15rem;
    }

    .nation-menu-item:hover {
        transform: none;
    }

    .nation-menu-name {
        font-size: 0.75rem;
    }

    .nation-menu-colors .color-dot-small {
        width: 8px;
        height: 8px;
    }

    /* Nation details - scrollable area below grid */
    .nation-details {
        flex: 1;
        width: 100%;
        padding: 0.5rem 0;
        padding-left: 0;
        overflow-y: auto;
        min-height: 0;
    }

    .nation-detail-content {
        gap: 1rem;
    }

    .nation-detail-header {
        padding-bottom: 0.5rem;
    }

    .nation-detail-name {
        font-size: 1.3rem;
    }

    .nation-detail-title {
        font-size: 0.9rem;
    }

    .nation-detail-colors {
        display: none;
    }

    .nation-units-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
    }

    .nation-unit-image {
        height: 100px;
    }

    .nation-unit-name {
        font-size: 0.65rem;
        padding: 0.3rem;
    }

    /* AI nation options */
    .ai-nation-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .ai-nation-option {
        padding: 0.75rem;
    }

    .option-icon {
        font-size: 1.5rem;
    }

    .option-name {
        font-size: 0.9rem;
    }

    .option-desc {
        font-size: 0.75rem;
    }

    /* Player items */
    .player_item {
        flex-wrap: wrap;
    }

    .player_info {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .players_header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .player_actions {
        flex-direction: column;
    }

    .player_actions .btn {
        width: 100%;
    }
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE (480px)
   ======================================== */

@media only screen and (max-width: 480px) {
    .nation-menu-item {
        padding: 0.4rem 0.5rem;
    }

    .nation-menu-name {
        font-size: 0.8rem;
    }

    .nation-detail-name {
        font-size: 1.1rem;
        letter-spacing: 1px;
    }

    .nation-detail-description {
        font-size: 0.85rem;
        padding: 0.6rem;
    }

    .nation-detail-traits h4,
    .nation-detail-units h4,
    .nation-detail-temperature h4,
    .nation-detail-sites h4 {
        font-size: 0.95rem;
    }

    .trait-item {
        font-size: 0.85rem;
        padding: 0.4rem 0.4rem 0.4rem 1.25rem;
    }

    .nation-units-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem;
    }

    .nation-unit-image {
        height: 80px;
    }

    .nation-unit-name {
        font-size: 0.6rem;
        min-height: 1.8rem;
    }

    /* AI options - single column on very small screens */
    .ai-nation-options {
        grid-template-columns: 1fr 1fr;
    }

    .ai-personality-options {
        gap: 0.5rem;
    }

    .ai-personality-option {
        padding: 0.75rem 0.5rem;
    }

    /* Temperature and sites */
    .temperature-info {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .temperature-desc {
        flex-basis: 100%;
        font-size: 0.8rem;
    }

    .nation-site-item {
        padding: 0.6rem 0.75rem;
    }

    .site-emoji {
        font-size: 1.2rem;
    }

    .site-name {
        font-size: 0.9rem;
    }

    .site-effects,
    .site-recruits {
        font-size: 0.75rem;
    }

    /* Detail rows */
    .detail_row {
        flex-direction: column;
        gap: 0.25rem;
    }

    .detail_label {
        font-size: 0.85rem;
    }

    /* Admin section */
    .admin_section h3 {
        font-size: 1.1rem;
    }

    .action_group h4 {
        font-size: 0.85rem;
    }

    .admin_actions {
        flex-direction: column;
    }

    .admin_actions .btn {
        width: 100%;
    }

    .warning-text {
        font-size: 0.8rem;
        padding: 0.6rem;
    }
}
