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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    color: #333;
    margin: 0;
}

.container {
    max-width: 100%;
    width: 100%;
    margin: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

header h1 {
    color: #667eea;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.1em;
}

.message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 30px;
}

.reservation-form-fullwidth {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    width: 100%;
    position: relative;
    z-index: 1;
    margin-top: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Sitzplan */
.seat-selection {
    position: relative;
    z-index: 1;
}

.seat-selection h2 {
    margin-bottom: 15px;
    color: #667eea;
}

.date-selector {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.date-selector label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.seat-map {
    position: relative;
    width: 100%;
    background: #f8f9fa;
    border: none;
    border-radius: 8px;
    margin-bottom: 20px;
    padding: 20px;
    overflow: visible;
    box-sizing: border-box;
    transform-origin: top left;
}

.stage {
    position: absolute;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border: 3px solid #1a252f;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2em;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    /* Position wird inline gesetzt */
}

.stage-editor {
    position: absolute;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border: 3px solid #1a252f;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2em;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    min-width: 200px;
    min-height: 40px;
}

.stage-header-editor {
    display: flex;
    flex-direction: row;
    gap: 5px;
    position: absolute;
    top: 5px;
    right: 5px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.stage-editor:hover .stage-header-editor {
    opacity: 1;
}

.stage-content {
    padding: 10px;
    text-align: center;
}


.table-group {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: none;
    min-width: 200px;
}

.table-label {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 8px;
    text-align: center;
    font-size: 0.9em;
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 10;
}

.table-visual {
    width: clamp(60px, 4vw, 100px);
    height: clamp(130px, 12vw, 200px);
    background: linear-gradient(135deg, #8b7355 0%, #6b5d4f 100%);
    border: none;
    border-radius: 8px;
    box-shadow: none;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: clamp(0.75em, 1.2vw, 1em);
    margin: 0;
    z-index: 5;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.seats-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    position: relative;
    align-items: center;
    padding: 0;
}

.seats-row {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    position: relative;
    gap: 0;
}

.seats-left, .seats-right {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
    flex-shrink: 0;
    min-width: 0;
    padding: 0;
    margin: 0;
}

.seats-left {
    justify-content: center;
    order: 1;
    margin-right: -2px; /* Stühle direkt an Tischkante */
}

.table-visual {
    order: 2;
    flex-shrink: 0;
}

.seats-right {
    justify-content: center;
    order: 3;
    margin-left: -2px; /* Stühle direkt an Tischkante */
}

.seat {
    width: clamp(35px, 3vw, 55px);
    height: clamp(35px, 3vw, 55px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid;
    font-size: clamp(0.7em, 1vw, 0.9em);
    position: relative;
    background: white;
}

.seat::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    z-index: -1;
}

.seat.available {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.seat.available:hover {
    background: #c3e6cb;
    transform: scale(1.1);
}

.seat.reserved {
    background: #dc3545;
    border-color: #c82333;
    color: #ffffff;
    cursor: not-allowed;
    font-weight: bold;
    box-shadow: 0 0 8px rgba(220, 53, 69, 0.5);
}

.seat.selected {
    background: #ffc107;
    border-color: #ff9800;
    color: #000000;
    transform: scale(1.1);
    font-weight: bold;
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.6);
}

.seat.selected-by-other {
    background: #2196f3;
    border-color: #1976d2;
    color: #ffffff;
    opacity: 1.0;
    cursor: not-allowed;
    font-weight: bold;
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.6);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1.0;
        box-shadow: 0 0 10px rgba(33, 150, 243, 0.6);
    }
    50% {
        opacity: 0.85;
        box-shadow: 0 0 15px rgba(33, 150, 243, 0.8);
    }
}

.legend {
    display: flex;
    gap: 15px;
    margin-bottom: 0;
    flex-wrap: wrap;
    position: fixed;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
    font-size: 0.85em;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
}

.legend-item .seat {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
}

.legend-item .seat {
    cursor: default;
}

.selected-seats-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.price-info {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

/* Formular */
.reservation-form {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    height: fit-content;
}

.reservation-form h2 {
    margin-bottom: 20px;
    color: #667eea;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
    min-width: 40px;
}

.zoom-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.zoom-controls button {
    font-size: 1.2em;
    font-weight: bold;
    padding: 8px 12px;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.2em;
    font-weight: 700;
}

.booking-header-actions {
    text-align: center;
    margin: 20px 0;
    padding: 15px 0;
    border-bottom: 2px solid #eee;
}

footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
    margin-top: 30px;
}

.admin-link {
    color: #667eea;
    text-decoration: none;
    font-size: 0.9em;
}

.admin-link:hover {
    text-decoration: underline;
}

.back-link {
    color: #667eea;
    text-decoration: none;
    display: inline-block;
    margin-top: 15px;
}

.back-link:hover {
    text-decoration: underline;
}

/* Login */
.login-container {
    max-width: 400px;
    margin: 50px auto;
    text-align: center;
}

.login-form {
    margin-top: 30px;
}

/* Admin Dashboard */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #eee;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.admin-form {
    max-width: 600px;
}

.editor-controls {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

.seat-editor-container {
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    min-height: 600px;
    position: relative;
    overflow: auto;
}

.seat-map-editor {
    position: relative;
    min-height: 1200px;
    width: 100%;
    background: #f8f9fa;
    background-image: 
        linear-gradient(to right, rgba(0, 0, 0, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    overflow: auto;
}

.table-group-editor {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: none;
    min-width: 200px;
    background: transparent;
    border: none;
    padding: 0;
}

.table-group-editor.selected {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.7);
    border-radius: 12px;
}

.table-label-editor {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 8px;
    text-align: center;
    font-size: 0.9em;
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
}

.table-header-editor {
    display: flex;
    flex-direction: row;
    gap: 5px;
    margin-bottom: 5px;
    cursor: move;
    width: 100%;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.table-group-editor:hover .table-header-editor {
    opacity: 1;
}

.btn-icon {
    background: rgba(102, 126, 234, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #667eea;
    transform: scale(1.1);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.table-name-input {
    border: 1px solid #ddd;
    padding: 6px;
    border-radius: 4px;
    font-weight: bold;
    flex: 1;
    margin-right: 8px;
}

.seats-container-editor {
    display: flex;
    flex-direction: row;
    width: 100%;
    position: relative;
    align-items: center;
    padding: 0;
}

.seats-row-editor {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    position: relative;
    gap: 0;
}

.seats-left-editor, .seats-right-editor {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
    flex-shrink: 0;
    min-width: 0;
    padding: 0;
    margin: 0;
    border: 2px dashed transparent;
    border-radius: 4px;
    transition: all 0.2s;
    min-height: 80px;
}

.seats-left-editor:hover, .seats-right-editor:hover {
    border-color: rgba(102, 126, 234, 0.3);
    background: rgba(102, 126, 234, 0.05);
}

.seats-left-editor {
    justify-content: center;
    order: 1;
    margin-right: -2px; /* Stühle direkt an Tischkante */
}

.table-visual-editor {
    width: clamp(60px, 4vw, 100px);
    height: clamp(130px, 12vw, 200px);
    background: linear-gradient(135deg, #8b7355 0%, #6b5d4f 100%);
    border: none;
    border-radius: 8px;
    box-shadow: none;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: clamp(0.75em, 1.2vw, 1em);
    margin: 0;
    z-index: 5;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    order: 2;
    flex-shrink: 0;
}

.seats-right-editor {
    justify-content: center;
    order: 3;
    margin-left: -2px; /* Stühle direkt an Tischkante */
}

.seat-editor {
    width: 45px; /* Standard-Größe, wird durch inline-style überschrieben */
    height: 45px; /* Standard-Größe, wird durch inline-style überschrieben */
    min-width: 20px; /* Minimale Größe erlauben */
    min-height: 20px; /* Minimale Größe erlauben */
    max-width: none; /* Keine maximale Größe erzwingen */
    max-height: none; /* Keine maximale Größe erzwingen */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: grab;
    border: 2px solid;
    transition: all 0.2s;
    font-size: clamp(0.7em, 1vw, 0.9em);
    position: relative;
    background: white;
    flex-shrink: 0;
    box-sizing: border-box;
}

.seat-editor:active {
    cursor: grabbing;
}

.seat-editor.available {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.seat-editor.reserved {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.seat-editor:hover {
    transform: scale(1.1);
}

/* .add-seat-btn entfernt - Stühle werden jetzt per Klick auf die Seiten hinzugefügt */

.reservations-list {
    margin-top: 20px;
}

.reservations-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.reservations-table th {
    background: #667eea;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.reservations-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.reservations-table tr:hover {
    background: #f8f9fa;
}

.reservations-table tr:last-child td {
    border-bottom: none;
}

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

.modal-content {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #eee;
}

.modal-header h2 {
    margin: 0;
    color: #667eea;
    font-size: 1.5em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2em;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 25px;
}

.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.modal-body .form-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.2s;
}

.modal-body .form-input:focus {
    outline: none;
    border-color: #667eea;
}

.color-picker-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-picker {
    width: 60px;
    height: 40px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-preview {
    width: 40px;
    height: 40px;
    border: 2px solid #ddd;
    border-radius: 6px;
    flex-shrink: 0;
}

.color-hex-input {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    font-family: monospace;
    text-transform: uppercase;
}

.color-hex-input:focus {
    outline: none;
    border-color: #667eea;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
