:root {	
	--primary-color: #2d4254;
	--secondary-color: #4a6378;
	--accent-color: #e74c3c;
	--light-color: #ecf0f1;
	--dark-color: #1a2a3a;
	--success-color: #27ae60;
	--warning-color: #f39c12;
	--danger-color: #e74c3c;
	--grid-size: 45px;
	--cell-size: 20px;
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: 'Montserrat', sans-serif;
	background-color: #f5f7fa;
	color: #333;
	line-height: 1.6;
}

/* Allgemeine Stile */
.container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 20px;
}

.flag { background: #fbc02d; }
.mine { background: #795548; }
.mine { background: #795548; }
.city { background: #4caf50; }
.trap { background: #e91e63; }
.hq { background: #3f51b5; }
.farm { background: #9c27b0; }
.water { background: #2196f3; }
.mountain { background: #757575; }
	
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 20px;
	border: none;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s;
	gap: 8px;
}

.btn:hover {
	transform: translateY(-2px);
}

.object-button {
	background-color: var(--light-color);
	color: var(--dark-color);
	border: 1px solid #ddd;
}

.object-button:hover {
	background-color: #f1f1f1;
}

.object-button.flag {
	background-color: #fbc02d;
}

.object-button.mine {
	background-color: #795548;
}

.object-button.city {
	background-color: #4caf50;
}

.object-button.trap {
	background-color: #e91e63;
}

.object-button.hq {
	background-color: #3f51b5;
}

.object-button.farm {
	background-color: #9c27b0;
}

.object-button.water {
	background-color: #2196f3;
}

.object-button.mountain {
	background-color: #757575;
}

.btn-primary {
	background-color: var(--secondary-color);
	color: white;
}

.btn-primary:hover {
	background-color: #3a5166;
	transform: translateY(-2px);
}

.btn-success {
	background-color: var(--success-color);
	color: white;
}


.btn-danger {
	background-color: var(--danger-color);
	color: white;
	border: none;
}

.btn-danger:hover {
	background-color: #da190b;
}

.btn-outline {
	background: transparent;
	border: 1px solid var(--light-color);
	color: var(--light-color);
}

.btn-outline:hover {
	background: rgba(255,255,255,0.1);
}

.btn-block {
	display: block;
	width: 100%;
}

.btn-icon {
	background: none;
	border: none;
	color: inherit;
	cursor: pointer;
	padding: 5px;
}

.badge {
	background: var(--secondary-color);
	color: white;
	padding: 3px 8px;
	border-radius: 12px;
	font-size: 12px;
	font-weight: 600;
}

/* App-Container */
.app-container {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	background-color: #f5f7fa;
}

/* Header */
header {
	background-color: var(--primary-color);
	color: white;
	padding: 15px 0;
	box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
	display: flex;
	justify-content: space-between;
	align-items: center;
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 20px;
}

.logo {
	display: flex;
	align-items: center;
	gap: 15px;
}

.logo img {
	height: 40px;
}

.header-actions {
	display: flex;
	align-items: center;
	gap: 20px;
}

.token-info {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
}

.token-value {
	background: rgba(0,0,0,0.2);
	padding: 5px 10px;
	border-radius: 4px;
	display: flex;
	align-items: center;
	gap: 5px;
}

/* Hauptinhalt */
.main-content {
	display: flex;
	flex: 1;
	padding: 20px;
	gap: 20px;
	max-width: 1400px;
	margin: 0 auto;
	width: 100%;
	flex-wrap: wrap;
	align-items: stretch;
}

/* Spielerbereich */
.player-section {
	width: 265px;
	min-width: 265px;
	display: flex;
	flex-direction: column;
	background-color: white;
	border-radius: 8px;
	box-shadow: 0 2px 10px rgba(0,0,0,0.05);
	overflow: hidden;
	height: 750px;
	/*height: 1263.77px;*/
}

.player-section h2 {
	font-size: 18px;
	padding: 15px 20px;
	background-color: var(--primary-color);
	color: white;
	display: flex;
	align-items: center;
	gap: 10px;
}

.player-form {
	padding: 15px;
	border-bottom: 1px solid #eee;
}

.form-group {
	margin-bottom: 12px;
}

.form-group input {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
}

.player-list-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 15px;
	background-color: #f8f9fa;
	border-bottom: 1px solid #eee;
}

.player-list {
	flex: 1;
	overflow-y: auto;
	padding: 10px;
}

.player-item {
	display: flex;
	align-items: center;
	padding: 10px;
	margin-bottom: 8px;
	background-color: #f8f9fa;
	border-radius: 6px;
	transition: all 0.2s;
	cursor: grab;
}

.player-item:hover {
	background-color: #e9ecef;
	transform: translateX(3px);
}

.player-info {
	flex: 1;
}

.player-name {
	font-weight: 600;
	margin-bottom: 2px;
}

.player-id {
	font-size: 12px;
	color: #7f8c8d;
}

.player-actions {
	opacity: 0;
	transition: opacity 0.2s;
}

.player-item:hover .player-actions {
	opacity: 1;
}

/* Grid-Bereich */
.grid-area {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.grid-controls {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 20px;
	margin-bottom: 15px;
	flex-wrap: wrap;
}

.element-palette {
	flex: 1;
	display: flex;
	background-color: white;
	border-radius: 8px;
	flex-direction: column;
	gap: 15px;
	padding: 15px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}


.element-buttons,
.element-tools {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.element-buttons button.active {
	background-color: var(--accent-color);
	color: white;
	transform: translateY(-2px);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.element-tools div {
	display: flex;
	gap: 10px;
	align-items: center;
}

.element-tools input {
	padding: 5px;
	border-radius: 4px;
	border: 1px solid #ddd;
}

.element-tools button {
	padding: 8px 16px;
	font-size: 14px;
	cursor: pointer;
}


.palette-title {
    font-size: 18px;
    font-weight: 600;
    padding: 15px 20px;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between; /* ← verteilt links/rechts */
    border-radius: 8px 8px 0 0;
}

.palette-title .title-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.element-option {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	background-color: #f8f9fa;
	border: 1px solid #e9ecef;
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.2s;
	flex: 0 0 auto; /* Prevents stretching */
	min-width: 100px; /* Ensures consistent width */
}

.element-option:hover {
	background-color: #e9ecef;
	transform: translateY(-2px);
}

.element-option.active::after {
	content: '';
	position: absolute;
	bottom: -5px;
	left: 50%;
	transform: translateX(-50%);
	width: 60%;
	height: 3px;
	background-color: var(--accent-color);
	border-radius: 3px;
}

.element-option.active .element-icon {
	filter: brightness(0) invert(1);
}

@keyframes toolPulse {
	0% { transform: scale(1); }
	50% { transform: scale(1.05); }
	100% { transform: scale(1); }
}

.element-option.active {
	animation: toolPulse 0.3s ease;
}

.element-icon {
	width: 20px;
	height: 20px;
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
}

.grid-tools {
	display: flex;
	flex-wrap: wrap; /* Allow items to wrap to the next line if needed */
	align-items: center;
	gap: 10px;
	background-color: white;
	border-radius: 8px;
	padding: 12px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
	max-width: 100%; /* Optional: Constrain to parent width */
}

.tool-button {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 10px 16px;
	background-color: #f8f9fa;
	border: 1px solid #e9ecef;
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.3s;
}

.tool-button:hover {
	background-color: #e9ecef;
}

.tool-button.warning {
	background-color: #fff3cd;
	border-color: #ffeeba;
	color: #856404;
}

.tool-button.warning:hover {
	background-color: #ffe8a1;
}

.grid-wrapper {
	flex: 1;
	height: 1050px;
	background-color: white;
	border-radius: 8px;
	box-shadow: 0 2px 10px rgba(0,0,0,0.05);
	padding: 15px;
	overflow: visible;
}

#grid-container {
    position: relative;
    width: 900px;
    height: 900px;
	margin: 0 auto;
	overflow: visible;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
}

#grid {
	display: grid;
	gap: 0;
	background-color: #eaebec;
	position: relative;
}

.cell {
	position: absolute;
	width: var(--cell-size);
	height: var(--cell-size);
	background: rgba(0, 0, 0, 0.05);
	border: 1px solid rgba(0, 0, 0, 0.05);
	cursor: pointer;
	font-size: 18px;
	line-height: 20px;
	box-sizing: border-box;
}

.flag { background: #fbc02d; }
.mine { background: #795548; }
.trap { background: #e91e63; }
.hq { background: #3f51b5; }
.farm { background: #9c27b0; }
.water { background: #2196f3; }
.mountain { background: #757575; }

.city-0-10s { background-color: rgba(0, 160, 78, 0.9); }
.city-11-20s { background-color: rgba(0, 183, 78, 0.9); }
.city-21-30s { background-color: rgba(3, 211, 93, 0.9); }
.city-31plus { background-color: rgba(3, 229, 101, 0.9); }

.march-time-label {
    z-index: 10;
    font-weight: bold;
    text-shadow: 0 0 2px white;
}

.grid-overlay {
	position: absolute;
	top: 0;
	left: 0;
	pointer-events: none;
	z-index: 2;
}

.grid-cell {
	width: var(--cell-size);
	height: var(--cell-size);
	background-color: white;
	border: 1px solid #ddd;
	box-sizing: border-box;
	position: relative;
}

.grid-cell:hover {
	background-color: #f5f5f5;
	z-index: 3;
	box-shadow: 0 0 0 2px var(--secondary-color);
}

.grid-header-row {
	display: flex;
	position: sticky;
	top: 0;
	z-index: 2;
	background-color: var(--primary-color);
	color: white;
}

.grid-header-cell, .grid-row-number {
	width: var(--grid-size);
	height: var(--grid-size);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: bold;
	font-size: 12px;
	background-color: var(--primary-color);
	color: white;
	position: sticky;
	z-index: 2;
}

.grid-row-number {
	left: 0;
	background-color: var(--secondary-color);
}

.grid-row {
	display: flex;
}

/* Element-Styles */
.cell-city { background-color: #d5f5e3; background-size: 80%; background-repeat: no-repeat; background-position: center; }
.cell-flag { background-color: #fadbd8; background-size: 70%; background-repeat: no-repeat; background-position: center; }
.cell-hq { background-color: #d6eaf8; background-size: 80%; background-repeat: no-repeat; background-position: center; }
.cell-trap { background-color: #e8daef; background-size: 80%; background-repeat: no-repeat; background-position: center; }
.cell-mine { background-color: #fdebd0; background-size: 80%; background-repeat: no-repeat; background-position: center; }
.cell-node { background-color: #e8f8f5; background-size: 80%; background-repeat: no-repeat; background-position: center; }
.cell-water { background-color: #d1f2eb; background-size: 80%; background-repeat: no-repeat; background-position: center; }
.cell-mountain { background-color: #d5dbdb; background-size: 80%; background-repeat: no-repeat; background-position: center; }

/* Grid-Aktionen */
.grid-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 15px;
	background-color: white;
	border-radius: 8px;
	padding: 15px;
	box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* Main cell styling (for multi-cell elements) */
.grid-cell.main-cell {
	position: relative;
	z-index: 2;
}

/* Visual indication of element boundaries */
.grid-cell[data-element-width="2"],
.grid-cell[data-element-width="3"] {
	border-right: 2px solid rgba(0,0,0,0.2);
}

.grid-cell[data-element-height="2"],
.grid-cell[data-element-height="3"] {
	border-bottom: 2px solid rgba(0,0,0,0.2);
}

/* Highlight the entire element on hover */
.grid-cell.main-cell:hover ~ .grid-cell {
	background-color: #f5f5f5;
}

/* Remove inner borders for multi-cell elements */
.grid-cell[data-element-width="2"] + .grid-cell,
.grid-cell[data-element-width="3"] + .grid-cell {
	border-left: none;
}

.grid-cell[data-element-height="2"] + .grid-cell,
.grid-cell[data-element-height="3"] + .grid-cell {
	border-top: none;
}

.grid-cell[class*="cell-"] {
	border: 1px solid rgba(0,0,0,0.2);
}

.main-cell {
	z-index: 2;
	box-shadow: 0 0 0 2px rgba(0,0,0,0.3);
}

/* Preview styling */
.preview-element {
	pointer-events: none;
	z-index: 4;
	border: 2px dashed rgba(255,255,255,0.7);
}

.preview-element.valid {
	border-color: rgba(255,255,255,0.9);
}

.preview-element.invalid {
	border-color: rgba(255,0,0,0.7);
}

.btn.large {
	padding: 12px 24px;
	font-size: 16px;
}

.grid-info {
	display: flex;
	gap: 15px;
	font-size: 14px;
	color: #7f8c8d;
}

/* Benachrichtigungen */
.notification {
	position: fixed;
	bottom: 20px;
	right: 20px;
	background: #333;
	color: white;
	padding: 1rem 1.5rem;
	border-radius: 6px;
	display: none;
}

.notification.success {
	background: #27ae60;
	transform: translateY(0);
	opacity: 1;
}

.notification.error {
	background: #e74c3c;
	transform: translateY(0);
	opacity: 1;
}

.notification.show {
	display: block;
	opacity: 1;
	transition: opacity 0.3s ease;
}

.notification.hidden {
	display: none;
	opacity: 0;
	pointer-events: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
	.main-content {
		flex-direction: column;
	}
	
	.player-section {
		width: 100%;
		min-width: auto;
	}
	
	.grid-controls {
		flex-direction: column;
	}
	
	.element-palette, .grid-tools {
		width: 100%;
	}
	
}

@media (max-width: 768px) {
	:root {
		--grid-size: 45px;
	}
	
	.header-content {
		flex-direction: column;
		gap: 15px;
		text-align: center;
	}
	
	.logo {
		justify-content: center;
	}
	
	.grid-actions {
		flex-direction: column;
		gap: 15px;
	}
	
	.element-buttons,
	.element-tools {
		justify-content: center;
	}
	
}
/* Modal Styles */
.modal {
	display: none; /* Hidden by default */
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	z-index: 1000; /* Ensure it is above all other content */
	justify-content: center;
	align-items: center;
}

.modal.show {
	display: flex;
}

.modal.hidden {
	display: none;
}

.modal-content {
	background: white;
	border-radius: 8px;
	padding: 20px;
	max-width: 400px;
	width: 100%;
	box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.modal h3 {
	margin-top: 0;
	font-size: 1.5rem;
	text-align: center;
	font-weight: bold;
}

.modal-actions {
	display: flex;
	justify-content: space-between;
}

.modal-actions .btn {
	padding: 10px 20px;
	font-size: 1rem;
	border-radius: 5px;
}

.modal-body {
	margin-bottom: 20px;
}

.form-control {
	width: 100%;
	padding: 10px;
	margin: 10px 0;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 1rem;
}

.modal-actions {
	display: flex;
	justify-content: space-between;
}

.modal-actions .btn {
	padding: 10px 20px;
	font-size: 1rem;
	border-radius: 5px;
}

.btn-primary {
	background-color: #4CAF50;
	color: white;
	border: none;
	cursor: pointer;
}

.btn-primary:hover {
	background-color: #45a049;
}

.btn-secondary {
	background-color: var(--secondary-color);
	color: white;
}

.btn-secondary:hover {
	background-color: #3a5166;
}

#copy-token {
	background: transparent;
	border: none;
	outline: none;
	cursor: pointer;
	padding: 0;
	color: inherit;
}

#copy-token:hover {
	background: transparent;
	border: none;
	outline: none;
	cursor: pointer;
	padding: 0;
	color: #00aaff;
}

#deleteSelectedBtn.active {
	background-color: #dc3545;
	border-color: #c82333;
}

.city-zone,
.flag-zone {
    background-color: rgba(206, 237, 215, 0.2);
}

#exportGridBtn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
}

#exportGridBtn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #fff;
}

.enhanced-player-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.enhanced-player-form .form-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.enhanced-player-form .input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.enhanced-player-form label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.enhanced-player-form input[type="text"],
.enhanced-player-form input[type="file"] {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    background-color: #fff;
    transition: border-color 0.2s;
}

.enhanced-player-form input[type="text"]:focus,
.enhanced-player-form input[type="file"]:focus {
    border-color: var(--secondary-color);
    outline: none;
}

#csv-upload {
    padding: 6px 10px;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    height: auto;
}

.cell.preview-highlight {
    background-color: rgba(46, 204, 113, 0.3) !important;
}

.cell.preview-highlight-invalid {
    background-color: rgba(231, 76, 60, 0.3) !important;
}

.cell.preview-outline-top-invalid {
    border-top: 2px solid #e74c3c !important;
}

.cell.preview-outline-right-invalid {
    border-right: 2px solid #e74c3c !important;
}

.cell.preview-outline-bottom-invalid {
    border-bottom: 2px solid #e74c3c !important;
}

.cell.preview-outline-left-invalid {
    border-left: 2px solid #e74c3c !important;
}

/* Neue Stile für die Markierung */
.player-selected {
    background-color: rgba(30, 144, 255, 0.2) !important;
    border-left: 3px solid dodgerblue !important;
}

.city-highlight {
    background-color: dodgerblue !important; /* Hellblau mit Transparenz */s
}


.city-label-highlight {
    color: black !important;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 2px gold inset; }
    50% { box-shadow: 0 0 0 5px rgba(255,215,0,0.7) inset; }
    100% { box-shadow: 0 0 0 2px gold inset; }
}

.player-number {
    color: #95a5a6;
    font-size: 0.8em;
    margin-left: 5px;
}

/* Arrow container around the grid */
.grid-arrow-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.grid-arrow {
    position: absolute;
    #width: 30px;
    #height: 30px;
    width: 32px;
    height: 32px;
    font-size: 16px;
    background: #4a6378;
    #background: rgba(255, 255, 255, 0.9);
    color: white;
    border: 1px solid #ccc;
    #border-radius: 50%;
    border-radius: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    pointer-events: auto;
}

.grid-arrow:hover {
    background: #4a6c48;
    transform: scale(1.1);
}

/* Position each arrow */
.grid-arrow.top-left {
    top: -15px;
    left: -15px;
}
.grid-arrow.top-center {
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
}
.grid-arrow.top-right {
    top: -15px;
    right: -15px;
}
.grid-arrow.middle-left {
    top: 50%;
    left: -15px;
    transform: translateY(-50%);
}
.grid-arrow.middle-right {
    top: 50%;
    right: -15px;
    transform: translateY(-50%);
}
.grid-arrow.bottom-left {
    bottom: -15px;
    left: -15px;
}
.grid-arrow.bottom-center {
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
}
.grid-arrow.bottom-right {
    bottom: -15px;
    right: -15px;
}