/* Crew View Styling - Retro-Futuristic Spaceship Interior */

.crew-view-container {
    position: relative;
    width: 100%;
    min-height: 600px;
    background: linear-gradient(to bottom, #1a1a2e 0%, #0f0f1e 100%);
    border: 5px solid #4a4a5a;
    border-radius: 15px;
    padding: 30px;
    overflow: hidden;
}

@media (max-width: 1024px) and (orientation: landscape) {
    .crew-view-container {
        min-height: 500px;
        padding: 20px;
    }
}

/* Space Viewport */
.space-viewport {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 20px solid #4a4a5a;
    border-radius: 50%;
    box-shadow: 
        inset 0 0 30px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(74, 74, 90, 0.6);
    z-index: 1;
}

@media (max-width: 1024px) and (orientation: landscape) {
    .space-viewport {
        width: 300px;
        height: 300px;
        border-width: 15px;
        top: 40%;
    }
}

/* Seats Container */
.seats-container {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    justify-content: center;
    z-index: 2;
}

.crew-seat {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #ff6b35 0%, #c44821 100%);
    border: 3px solid #ff8c5a;
    border-radius: 15px;
    padding: 15px;
    min-width: 140px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    transition: all 0.3s;
}

.crew-seat.ready {
    border-color: #00ff00;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.6);
}

.crew-seat.captain {
    border-color: #ffff00;
    background: linear-gradient(135deg, #ffaa00 0%, #ff8800 100%);
}

.crew-seat.empty {
    background: linear-gradient(135deg, #333 0%, #222 100%);
    border-color: #555;
}

.crew-seat.bot {
    background: linear-gradient(135deg, #505050 0%, #303030 100%);
    border-color: #808080;
    box-shadow: 0 0 15px rgba(128, 128, 128, 0.5);
}

.crew-seat:hover:not(.empty) {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
}

.seat-avatar {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    margin-bottom: 10px;
}

.empty-seat-placeholder {
    width: 150px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 1.2em;
    font-style: italic;
}

.add-bot-button {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #4a9eff 0%, #2a7edf 100%);
    border: 2px solid #6ab4ff;
    border-radius: 8px;
    width: 50px;
    height: 50px;
    font-size: 1.8em;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.add-bot-button:hover {
    background: linear-gradient(135deg, #6ab4ff 0%, #4a9eff 100%);
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.6);
}

.add-bot-button:active {
    transform: translateX(-50%) translateY(0px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

/* Nameplate */
.nameplate {
    text-align: center;
    width: 100%;
}

.player-name {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 3px;
    color: #fff;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
}

.player-role {
    font-size: 0.9em;
    color: #ffc107;
    margin-bottom: 3px;
}

.player-status {
    font-size: 0.85em;
    color: #aaa;
}

/* Environmental Details */
.environmental-pipes-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(90deg, 
        #ff6b35 0%, 
        #ffc107 25%, 
        #ff6b35 50%, 
        #ffc107 75%, 
        #ff6b35 100%);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    z-index: 3;
}

/* Avatar Customization Styles */
.avatar-customization {
    background: rgba(0, 0, 0, 0.85);
    border: 3px solid #ff6b35;
    border-radius: 15px;
    padding: 30px;
    max-width: 900px;
    margin: 0 auto;
}

/* Game Area Crew View - Compact Version */
.game-crew-view-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    background: linear-gradient(to bottom, #1a1a2e 0%, #0f0f1e 100%);
    border: 3px solid #4a4a5a;
    border-radius: 10px;
    min-height: 300px;
}

.game-crew-view-container .space-viewport {
    width: 300px;
    height: 300px;
    margin: 0 auto 20px;
    border-width: 10px;
}

.game-crew-view-container .seats-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
}

.crew-seat.compact {
    min-width: 100px;
    padding: 10px;
}

.crew-seat.compact canvas {
    width: 80px;
    height: 120px;
}

.crew-seat.compact .nameplate {
    font-size: 0.85em;
}

.crew-seat.compact .player-name {
    font-size: 0.9em;
}

.crew-seat.compact .player-role {
    font-size: 0.75em;
}

.crew-seat.compact .player-status {
    font-size: 0.7em;
}

.game-crew-view-container .environmental-pipes-top {
    height: 30px;
}

/* Avatar Customization Styles */
.avatar-customization {
    background: rgba(0, 0, 0, 0.85);
    border: 3px solid #ff6b35;
    border-radius: 15px;
    padding: 30px;
    max-width: 900px;
    margin: 0 auto;
}

.avatar-customization h2 {
    color: #ff6b35;
    text-align: center;
    margin-bottom: 20px;
    font-size: 2em;
    text-shadow: 0 0 10px #ff6b35;
}

.avatar-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
}

.avatar-preview-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 500px;
}

#avatarPreview {
    background: rgba(0, 50, 100, 0.3);
    border: 3px solid #00ff00;
    border-radius: 10px;
    margin-bottom: 15px;
}

.avatar-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.option-group {
    background: rgba(0, 100, 255, 0.1);
    border: 2px solid #0066ff;
    border-radius: 8px;
    padding: 15px;
}

.option-group h3 {
    color: #00aaff;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.option-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.option-btn {
    padding: 8px 15px;
    background: rgba(0, 100, 255, 0.3);
    border: 2px solid #0066ff;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    transition: all 0.2s;
}

.option-btn:hover {
    background: rgba(0, 150, 255, 0.5);
    transform: scale(1.05);
}

.option-btn.selected {
    background: rgba(0, 255, 0, 0.3);
    border-color: #00ff00;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.color-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #666;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.color-btn:hover {
    transform: scale(1.1);
    border-color: #fff;
}

.color-btn.selected {
    border: 3px solid #00ff00;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.8);
}

.avatar-action-buttons {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-avatar-randomize {
    background: #9b51e0;
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-avatar-randomize:hover {
    background: #b96bff;
    transform: scale(1.05);
}

.btn-avatar-continue {
    background: #00ff00;
    color: #000;
    border: none;
    padding: 12px 40px;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-avatar-continue:hover {
    background: #00ff88;
    transform: scale(1.05);
}

/* Space Chairs Layout with Animated Starfield */
.space-chairs-container {
    position: relative;
    width: 100%;
    min-height: 500px;
    padding: 20px;
    overflow: visible;
}

.space-window-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    z-index: 0;
}

.window-frame {
    width: 100%;
    height: 100%;
    border: 15px solid #3a3a4a;
    border-radius: 20px;
    background: #000814;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

.starfield-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.chairs-row {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 60px;
    margin-top: 300px;
    padding: 20px;
}

.space-chairs-container .chairs-row {
    gap: 60px;
}

.space-chair-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: auto;
    min-width: 150px;
}

.space-chair {
    position: relative;
    width: 150px;
    height: 210px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
}

.chair-back {
    width: 120px;
    height: 110px;
    background: linear-gradient(180deg, #ff6b35 0%, #d04a1e 100%);
    border-radius: 15px 15px 5px 5px;
    border: 3px solid #c44821;
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.avatar-container {
    position: absolute;
    top: -20px;                /* Changed from 10px to -20px to move up */
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.player-avatar-canvas {
    display: block;
    image-rendering: crisp-edges;
    transform: scale(1.12);
}

.chair-seat {
    width: 130px;
    height: 55px;
    background: linear-gradient(180deg, #ff7b45 0%, #d05a2e 100%);
    border-radius: 10px;
    border: 3px solid #c44821;
    margin-top: -10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.chair-base {
    width: 40px;
    height: 30px;
    background: linear-gradient(180deg, #666 0%, #333 100%);
    border-radius: 5px;
    margin-top: 5px;
}

.space-chair.empty {
    opacity: 0.4;
}

.space-chair.empty .chair-back,
.space-chair.empty .chair-seat {
    background: linear-gradient(180deg, #555 0%, #333 100%);
    border-color: #444;
}

/* Player HUD - Full stats display */
.player-hud {
    text-align: center;
    background: rgba(0, 0, 0, 0.85);
    padding: 12px 15px;
    border-radius: 8px;
    border: 2px solid #00ff88;
    min-width: auto;
    max-width: none;
    width: auto;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.5;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.space-chairs-container .player-hud {
    min-width: auto;
    max-width: none;
    width: auto;
}

.player-hud.status-dead {
    border-color: #ff0000;
    opacity: 0.7;
}

.player-hud.status-disconnected {
    border-color: #666;
    opacity: 0.6;
}

.player-hud .name-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.3);
}

.player-hud .hud-name {
    font-size: 13px;
    font-weight: bold;
    color: #00ff88;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    flex: 1;
    text-shadow: 0 0 5px rgba(0, 255, 136, 0.5);
}

.player-hud .hud-role {
    font-size: 9px;
    color: #aaa;
    background: rgba(0, 100, 255, 0.3);
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    margin-top: 4px;
}

.player-hud .stat-row {
    text-align: left;
    margin: 3px 0;
    color: #ccc;
    font-size: 11px;
}

.player-hud .stat-row.status-text {
    color: #ffcc00;
    font-weight: bold;
}

/* Keep small empty slot style */
.player-info.empty-slot {
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid #444;
    min-width: 150px;
    max-width: 150px;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    opacity: 0.5;
}

.player-info.empty-slot .player-name {
    font-size: 14px;
    font-weight: bold;
    color: #666;
}

/* Responsive: Mobile landscape mode - 2x2 grid layout */
@media (max-width: 1024px) and (orientation: landscape) {
    /* Lobby View - 2x2 Grid for seats */
    .seats-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, auto);
        gap: 15px;
        max-width: 600px;
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        margin: 20px auto 0;
    }
    
    .crew-seat {
        min-width: 120px;
        padding: 12px;
    }
    
    .seat-avatar {
        width: 120px;
        height: 160px;
    }
    
    .nameplate {
        font-size: 0.9em;
    }
    
    .player-name {
        font-size: 0.95em;
    }
    
    .player-role {
        font-size: 0.8em;
    }
    
    .player-status {
        font-size: 0.75em;
    }
    
    /* Game View - 2x2 Grid for space chairs */
    .space-chairs-container {
        min-height: auto;
        padding: 15px;
    }
    
    .chairs-row {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, auto);
        gap: 20px;
        margin-top: 20px;
        padding: 15px;
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .space-chair-container {
        min-width: auto;
        width: 100%;
    }
    
    .space-chair {
        width: 120px;
        height: 180px;
    }
    
    .chair-back {
        width: 100px;
        height: 90px;
    }
    
    .chair-seat {
        width: 110px;
        height: 45px;
    }
    
    .player-avatar-canvas {
        transform: scale(0.9);
    }
    
    .player-hud {
        font-size: 9px;
        padding: 8px 10px;
    }
    
    .player-hud .hud-name {
        font-size: 10px;
    }
    
    .player-hud .hud-role {
        font-size: 8px;
    }
    
    .player-hud .stat-row {
        font-size: 9px;
    }
    
    .space-window-background {
        height: 40%;
    }
    
    .ration-vote-ui {
        font-size: 10px;
        padding: 6px;
    }
    
    .vote-btn {
        font-size: 9px;
        padding: 6px 10px;
    }
}

/* Fallback for very small mobile devices or portrait */
@media (max-width: 768px) {
    .space-chairs-container {
        overflow-x: auto;
        overflow-y: visible;
    }
    
    .chairs-row {
        min-width: max-content;
    }
    
    .player-hud {
        font-size: 10px;
    }
    
    .player-hud .hud-name {
        font-size: 11px;
    }
}

/* Ration Vote UI - Display under player chairs */
.ration-vote-ui {
    margin-top: 10px;
    padding: 10px;
    background: rgba(20, 20, 40, 0.9);
    border: 2px solid #ff9900;
    border-radius: 8px;
    font-size: 12px;
}

.vote-results {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.vote-title {
    font-weight: bold;
    font-size: 13px;
    color: #ffaa00;
    margin-bottom: 5px;
}

.voter-result {
    font-size: 12px;
    color: #ddd;
    padding: 2px 0;
}

.vote-buttons {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.vote-button-container {
    display: flex;
    gap: 5px;
}

.vote-btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.vote-approve {
    background: rgba(0, 255, 0, 0.3);
    border-color: #00ff00;
    color: #fff;
}

.vote-approve:hover {
    background: rgba(0, 255, 0, 0.5);
    transform: scale(1.05);
}

.vote-deny {
    background: rgba(255, 0, 0, 0.3);
    border-color: #ff0000;
    color: #fff;
}

.vote-deny:hover {
    background: rgba(255, 0, 0, 0.5);
    transform: scale(1.05);
}

.vote-status {
    text-align: center;
    font-size: 20px;
}

.vote-result {
    font-size: 18px;
}
}