/* Main layout */
body {
    background: #fafafa;
    margin: 0;
    padding: 0;
}

.main-layout {
    display: flex;
    align-items: flex-start;
    min-height: calc(100vh - 120px); /* Account for header space */
    gap: 10px;
}

.main-content {
    flex: 1;
    min-width: 0; /* Allow flexbox to shrink this */
}

.sidebar {
    width: 30%;
    flex-shrink: 0;
    border-left: 1px solid #bbb;
    padding-left: 10px;
    align-self: stretch;
    display: flex;
    flex-direction: column;
}

.sidebar-section {
    margin-bottom: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sidebar-section h3 {
    font-size: 13px;
    font-weight: normal;
    color: #555;
    margin: 0 0 8px 0;
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, Consolas, 'Courier New', monospace;
}

.location {
    border: 1px solid #bbb;
    margin: 5px;
    padding: 8px;
    border-radius: 5px;
    background: white;
}

.card-area {
    min-height: 40px;
    border: none;
    padding: 5px;
    margin-top: 5px;
}

.hand-row {
    display: flex;
    gap: 0;
}

.hand-row .location {
    flex: 1;
}

.discard-row {
    display: flex;
    gap: 0;
}

.discard-row .location {
    flex: 1;
}

h2 {
    font-size: 15px;
    font-weight: normal;
    color: #555;
    margin: 0 0 5px 0;
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, Consolas, 'Courier New', monospace;
}

.card {
    display: flex;
    align-items: center;
    padding: 5px;
    margin: 2px 0;
    background: #fffef8;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: opacity 0.2s ease;
}

/* Drag and drop styles */
.card.dragging {
    opacity: 0.5;
}

.card[draggable="true"] {
    cursor: move;
}

.card[draggable="true"]:hover {
    background: #fff8e1;
    border-color: #ccc;
}

.card.highlighted {
    background: #fff9c4;
    border-color: #f9a825;
}

.card-actions {
    display: flex;
    gap: 5px;
    margin-right: 10px;
}

.card-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.discard-icon {
    background: #d4933d;
    color: white;
}

.discard-icon:hover {
    background: #c08534;
}

.remove-icon {
    background: #c75555;
    color: white;
}

.remove-icon:hover {
    background: #b34545;
}

.remove-icon.hidden {
    visibility: hidden;
}

.airplane-icon {
    background: #5b9bd5;
    color: white;
}

.airplane-icon:hover {
    background: #4a8bc2;
}

.airplane-icon.hidden {
    visibility: hidden;
}

.card-text {
    cursor: pointer;
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, Consolas, 'Courier New', monospace;
    font-size: 13px;
}

.card-text:hover {
    text-decoration: underline;
}

.location.selected {
    background-color: #fff8f0;
    border-color: #ff9800;
}

.location.side-us {
    border-color: #1565c0;
    border-width: 2px;
}

.location.side-us h2 {
    color: #1565c0;
}

.location.side-ussr {
    border-color: #c62828;
    border-width: 2px;
}

.location.side-ussr h2 {
    color: #c62828;
}

.location h2 {
    cursor: pointer;
}

.card-text.us {
    color: #1976d2;
    font-weight: 500;
}

.card-text.ussr {
    color: #d32f2f;
    font-weight: 500;
}

.card-text.neutral {
    color: #7b1fa2;
    font-weight: 500;
}

.deck-subsections {
    display: flex;
    gap: 10px;
}

.deck-subsection {
    flex: 1;
}

.deck-subsection h3 {
    font-size: 13px;
    font-weight: normal;
    color: #666;
    margin: 0 0 8px 0;
    text-align: center;
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, Consolas, 'Courier New', monospace;
}

.game-title-container {
    margin: 20px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-title-input {
    font-size: 16px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    text-align: center;
    min-width: 200px;
}

.game-title-input:focus {
    outline: none;
    border-color: #888;
}

.game-title-input::placeholder {
    color: #999;
    font-style: italic;
}

.title-buttons {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    gap: 20px;
}

.controls-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.controls-section.display-controls {
    margin-left: 5px;
}

.controls-section.display-controls #clear-highlight-btn {
    margin-left: 8px;
}

.controls-section.deck-management {
    margin-left: auto;
}

.controls-section label {
    font-size: 14px;
    white-space: nowrap;
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, Consolas, 'Courier New', monospace;
}

.highlight-select {
    padding: 5px 8px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 12px;
}

.highlight-select:hover {
    border-color: #888;
}

.short-checkbox-label {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 8px;
    white-space: nowrap;
}

.title-btn {
    padding: 6px 12px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.title-btn:hover {
    background: #f5f5f5;
    border-color: #888;
}

.title-btn:disabled {
    cursor: not-allowed;
    background: #f9f9f9;
    color: #ccc;
    border-color: #e0e0e0;
}

.title-btn:disabled:hover {
    background: #f9f9f9;
}

#undo-btn:not(:disabled) {
    background: white;
    border-color: #bbb;
}

#undo-btn:not(:disabled):hover {
    background: #f5f5f5;
    border-color: #888;
}

.undo-flash {
    animation: undoFlash 0.3s ease-in-out;
}

@keyframes undoFlash {
    0% { background-color: rgba(255, 152, 0, 0.1); }
    50% { background-color: rgba(255, 152, 0, 0.3); }
    100% { background-color: transparent; }
}

.location-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.hand-controls {
    display: flex;
    gap: 5px;
    margin-left: auto;
}

.hand-control-icon {
    background: #7aac7d;
    color: white;
}

.hand-control-icon:hover {
    background: #689a6b;
}

.unknown-minus-icon {
    background: #d4933d;
    color: white;
}

.unknown-minus-icon:hover {
    background: #c08534;
}

.unknown-card-text {
    color: #616161;
    font-style: italic;
}

.ops-average {
    font-size: 11px;
    color: #777;
    font-weight: normal;
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, Consolas, 'Courier New', monospace;
}


.game-notes {
    width: 100%;
    height: 800px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 16px;
    resize: vertical;
    box-sizing: border-box;
    background: white;
    flex: 1;
}

.game-notes:focus {
    outline: none;
    border-color: #888;
}

.game-notes::placeholder {
    color: #999;
    font-style: italic;
}

.github-link {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    margin-left: auto;
    padding: 4px 8px;
    font-size: 14px;
    color: #555;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    width: fit-content;
}

.github-link:hover {
    background-color: #f0f0f0;
    color: #000;
}

.github-link svg {
    flex-shrink: 0;
}

.game-management {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
}

.game-selector {
    flex: 1;
    padding: 5px 8px;
    border: 1px solid #bbb;
    border-radius: 3px;
    font-size: 14px;
    background: white;
}

.game-btn {
    padding: 5px 10px;
    border: 1px solid #bbb;
    border-radius: 3px;
    background: white;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.game-btn:hover {
    background: #f5f5f5;
    border-color: #888;
}

.game-btn.danger {
    color: #d32f2f;
    border-color: #d32f2f;
}

.game-btn.danger:hover {
    background: #ffeaea;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    text-align: center;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #555;
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, Consolas, 'Courier New', monospace;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #bbb;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #888;
}

.form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.modal-btn {
    flex: 1;
    padding: 8px 16px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.modal-btn:hover {
    background: #f5f5f5;
    border-color: #888;
}

.modal-btn-primary {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

.modal-btn-primary:hover {
    background: #1565c0;
    border-color: #1565c0;
}