* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    background-color: #f4f4f4;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    margin-bottom: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.setup-controls, .element-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    background-color: #4CAF50;
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 240px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 4px;
    padding: 10px;
}

.dropdown:hover .dropdown-content,
.dropdown:focus-within .dropdown-content {
    display: block;
}

.dropdown select {
    width: 100%;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
}

.file-controls {
    display: flex;
    gap: 8px;
}

.custom-file-upload {
    display: inline-block;
    padding: 8px 15px;
    background-color: #2196F3;
    color: white;
    border-radius: 4px;
    cursor: pointer;
}

.custom-file-upload:hover {
    background-color: #0b7dda;
}

.custom-file-upload input[type="file"] {
    display: none;
}

.action-button.secondary {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.9em;
}

.action-button.secondary:hover {
    background-color: #d32f2f;
}

button, select, input {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background-color: #2c3e50;
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

select, input[type="text"] {
    background-color: white;
    color: #333;
    border: 1px solid #e0e0e0;
}

button:hover {
    background-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.add-element {
    background-color: #27ae60;
    margin: 3px;
    padding: 8px 12px;
    min-width: 110px;
}

.add-element:hover {
    background-color: #2ecc71;
}

#clear-field {
    background-color: #e74c3c;
}

#clear-field:hover {
    background-color: #c0392b;
}

#print-field {
    background-color: #3498db;
}

#print-field:hover {
    background-color: #2980b9;
}

#save-setup {
    background-color: #f39c12;
}

#save-setup:hover {
    background-color: #e67e22;
}

#close-properties, #delete-element {
    margin-top: 5px;
}

#delete-element {
    background-color: #e74c3c;
}

#delete-element:hover {
    background-color: #c0392b;
}

#football-field {
    width: 100%;
    height: 600px;
    background-image: url('../images/football-field.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: relative;
    border: none;
    margin: 0 auto;
    overflow: hidden;
}

.field-element {
    position: absolute;
    cursor: move;
    user-select: none;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.field-element.selected {
    outline: 2px dashed yellow;
    z-index: 20;
}

.player {
    width: 40px;
    height: 40px;
    background-image: url('../images/player.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.cone {
    width: 30px;
    height: 40px;
    background-image: url('../images/cone.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.ball {
    width: 30px;
    height: 30px;
    background-image: url('../images/ball.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.ladder {
    width: 100px;
    height: 30px;
    background-image: url('../images/ladder.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.goal {
    width: 100px;
    height: 60px;
    background-image: url('../images/goal.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.hurdle {
    width: 80px;
    height: 50px;
    background-image: url('../images/hurdle.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.slalom {
    width: 30px;
    height: 80px;
    background-image: url('../images/slalom.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.minigoal {
    width: 60px;
    height: 40px;
    background-image: url('../images/minigoal.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.dummy {
    width: 50px;
    height: 80px;
    background-image: url('../images/dummy.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.ring {
    width: 40px;
    height: 40px;
    background-image: url('../images/ring.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.arrow {
    position: absolute;
    height: 8px;
    background-color: #e74c3c;
    transform-origin: left center;
}

.arrow::after {
    content: '';
    position: absolute;
    right: -12px;
    top: -6px;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 15px solid #e74c3c;
}

#element-properties {
    position: absolute;
    background-color: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 280px;
    border-top: 5px solid #3498db;
    cursor: move; /* Zeigt an, dass das Element verschiebbar ist */
}

#element-properties.hidden,
.hidden {
    display: none !important;
}

#element-properties h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 20px;
    text-align: center;
    position: relative;
}

#element-properties h3:after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background-color: #3498db;
    border-radius: 3px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 500;
    color: #555;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    outline: none;
    margin: 5px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

@media (max-width: 768px) {
    #football-field {
        height: 400px;
    }
    
    .setup-controls, .element-controls {
        flex-direction: column;
    }
}

/* Print-specific styling for normal page elements and print view */
.print-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    box-sizing: border-box;
    position: relative;
}

#print-football-field {
    aspect-ratio: 4/3; /* Festlegung des gleichen Seitenverhältnisses wie das Original-Feld */
    margin: 0 auto;
    position: relative;
    transform-origin: center center;
}

.print-title {
    text-align: center;
    margin-bottom: 15px;
    padding: 10px;
}

.print-title h2 {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.print-title p {
    margin: 5px 0 0;
    font-size: 14px;
    color: #666;
}

/* Print styles for A4 landscape format */
@media print {
    @page {
        size: A4 landscape;
        margin: 0;
    }
    
    html, body {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        background-color: white;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        overflow: hidden;
    }
    
    .container, header, .controls, #element-properties, button, .no-print {
        display: none !important;
    }
    
    .print-container {
        display: flex !important;
        justify-content: center; /* horizontale Zentrierung */
        align-items: center;    /* vertikale Zentrierung */
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        padding: 0;
        margin: 0;
        page-break-inside: avoid;
        page-break-after: avoid;
        overflow: hidden;
    }
    
    #print-football-field {
        /* Keine Skalierung, 1:1 Abbildung */
        background-position: center;
        background-repeat: no-repeat;
        border: none;
        page-break-inside: avoid;
        page-break-after: avoid;
        /* Exakte Größe vom Original-Element */
        transform: none !important; /* Keine automatische Transformation */
    }
    
    .field-element {
        page-break-inside: avoid;
        overflow: visible;
    }
    
    .field-element.selected {
        outline: none; /* Remove selection outline when printing */
    }
    
    /* Verhindert jeglichen Inhalt nach dem Fußballfeld */
    .print-container:after {
        content: none !important;
    }
}
