/* ===================================
   Pizza Connection Konfigurator
   90er Retro Gaming Style
   =================================== */

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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    min-height: 100vh;
    padding: 10px 20px;
}

.container {
    max-width: 95%;
    margin: 0 auto;
}

/* ===================================
   HEADER
   =================================== */

.header {
    text-align: center;
    padding: 10px 20px;
    background: linear-gradient(135deg, #d4145a 0%, #fbb034 100%);
    border: 4px solid #fff;
    box-shadow: 0 4px 0 #000, 0 4px 10px rgba(0,0,0,0.5);
    margin-bottom: 10px;
    position: relative;
}

.header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 2px solid rgba(255,255,255,0.3);
    pointer-events: none;
}

.header h1 {
    font-size: 2em;
    text-shadow: 3px 3px 0 #000;
    letter-spacing: 3px;
    margin-bottom: 2px;
}

.subtitle {
    font-size: 1em;
    color: #fff;
    text-shadow: 2px 2px 0 #000;
}

/* ===================================
   MAIN CONTENT LAYOUT
   =================================== */

.main-content {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 15px;
    margin-bottom: 0;
}

/* ===================================
   INGREDIENTS SIDEBAR
   =================================== */

.ingredients-sidebar {
    background: #0f3460;
    border: 4px solid #16a085;
    box-shadow: 0 4px 0 #000, 0 4px 15px rgba(0,0,0,0.3);
    padding: 12px;
}

.ingredients-sidebar h2 {
    text-align: center;
    margin-bottom: 8px;
    color: #fbb034;
    text-shadow: 2px 2px 0 #000;
    font-size: 1.2em;
}

.ingredients-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

.ingredient-item {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #16a085;
    padding: 6px 4px;
    text-align: center;
    cursor: grab;
    transition: all 0.2s;
    position: relative;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.ingredient-item:hover {
    transform: translateY(-3px) scale(1.05);
    border-color: #fbb034;
    box-shadow: 0 6px 0 #000, 0 6px 15px rgba(251, 176, 52, 0.5);
}

.ingredient-item:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.ingredient-item .ingredient-icon {
    width: 40px;
    height: 40px;
    display: block;
    margin: 0 auto 2px;
    object-fit: contain;
    pointer-events: none;
}

.ingredient-item .name {
    font-size: 0.7em;
    color: #fff;
    text-transform: uppercase;
}

/* ===================================
   PIZZA SECTION
   =================================== */

.pizza-section {
    background: #0f3460;
    border: 4px solid #16a085;
    box-shadow: 0 4px 0 #000, 0 4px 15px rgba(0,0,0,0.3);
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.pizza-container {
    position: relative;
    width: 81%;
    aspect-ratio: 1 / 1;
    margin-bottom: 0;
}

.pizza-dough {
    position: absolute;
    width: 90%;
    height: 90%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: transparent;
    border-radius: 50%;
    box-shadow:
        0 8px 0 #000,
        0 8px 20px rgba(0,0,0,0.5);
    position: relative;
}

/* Basis-Layer für Teig und Sauce */
.pizza-base-layer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#teigLayer {
    z-index: 1;
}

#sauceLayer {
    z-index: 2;
    width: 85%;
    height: 85%;
}


.dough-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    height: 90%;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

/* Platzierte Zutaten auf der Pizza */
.placed-ingredient {
    position: absolute;
    width: 18%;
    height: 18%;
    cursor: move;
    transition: all 0.2s;
    z-index: 10;
    animation: placeIngredient 0.3s ease-out;
    object-fit: contain;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.placed-ingredient.no-animation {
    animation: none;
}

.placed-ingredient.dragging {
    opacity: 0.5;
    cursor: grabbing;
    pointer-events: none;
}

.placed-ingredient:hover {
    transform: translate(-50%, -50%) scale(1.2) rotate(5deg) !important;
    filter: drop-shadow(0 0 10px rgba(251, 176, 52, 0.8));
}

@keyframes placeIngredient {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2) rotate(180deg);
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(360deg);
        opacity: 1;
    }
}

/* ===================================
   INFO BOX
   =================================== */

.info-box {
    background: #1a1a2e;
    border: 2px solid #16a085;
    padding: 8px;
    text-align: center;
}

.info-box p {
    margin: 0;
    color: #fbb034;
    font-size: 0.8em;
}

/* ===================================
   CONTROLS
   =================================== */

.controls {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.controls-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.btn {
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    font-weight: bold;
    padding: 8px 12px;
    border: 3px solid #fff;
    background: linear-gradient(135deg, #16a085 0%, #0f7a63 100%);
    color: #fff;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 0 #000, 0 4px 10px rgba(0,0,0,0.3);
    transition: all 0.2s;
    position: relative;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #000, 0 6px 15px rgba(0,0,0,0.4);
}

.btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #000, 0 2px 5px rgba(0,0,0,0.3);
}

.btn-reset {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.btn-save {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.btn-load {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
}

.btn-order {
    background: linear-gradient(135deg, #f39c12 0%, #d68910 100%);
}

/* ===================================
   MODAL
   =================================== */

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

.modal.active {
    display: flex;
}

.modal-content {
    background: #0f3460;
    border: 4px solid #16a085;
    box-shadow: 0 8px 0 #000, 0 8px 30px rgba(0,0,0,0.5);
    padding: 30px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.modal-content h3 {
    color: #fbb034;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.8em;
    text-shadow: 2px 2px 0 #000;
}

.modal-content p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.modal-content textarea {
    width: 100%;
    min-height: 120px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    padding: 10px;
    background: #1a1a2e;
    color: #fff;
    border: 3px solid #16a085;
    margin-bottom: 15px;
    resize: vertical;
}

/* ===================================
   ORDER FORM
   =================================== */

.modal-order {
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.form-group label {
    display: block;
    color: #fbb034;
    margin-bottom: 4px;
    font-size: 0.9em;
}

.form-group input[type="text"],
.form-group input[type="email"] {
    width: 100%;
    padding: 8px 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    background: #1a1a2e;
    color: #fff;
    border: 2px solid #16a085;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #fbb034;
}

.form-group textarea {
    width: 100%;
    min-height: 60px;
    padding: 8px 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    background: #1a1a2e;
    color: #fff;
    border: 2px solid #16a085;
    resize: vertical;
}

.form-group textarea:disabled {
    opacity: 0.6;
    color: #999;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #fff;
    font-size: 0.85em;
    background: #1a1a2e;
    border: 2px solid #16a085;
    padding: 5px 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.checkbox-label:hover {
    border-color: #fbb034;
}

.checkbox-label input[type="checkbox"] {
    accent-color: #fbb034;
}

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

.form-buttons .btn {
    flex: 1;
}

.form-hint {
    margin-top: 10px;
    text-align: center;
    font-size: 0.75em;
    color: #888;
}

/* ===================================
   DRAG & DROP STATES
   =================================== */

.ingredient-item.dragging {
    opacity: 0.5;
}

.pizza-dough.drag-over {
    box-shadow:
        inset 0 0 30px rgba(251, 176, 52, 0.5),
        0 8px 0 #000,
        0 8px 20px rgba(251, 176, 52, 0.8);
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 320px 1fr;
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .ingredients-sidebar {
        order: 2;
    }

    .pizza-section {
        order: 1;
    }

    .header h1 {
        font-size: 2em;
    }

    .ingredients-grid {
        grid-template-columns: 1fr 1fr;
    }
}
