/* css/admin.css - KOMPLETT MIT ALLEN FIXES */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ba9a5b;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

body.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: white;
    padding: 30px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 420px;
    text-align: center;
    animation: slideIn 0.6s ease-out;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════
   LAYOUT
══════════════════════════════ */
.admin-container {
    max-width: 1600px;
    width: 95%;
    margin: 0 auto;
    padding: 30px 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 25px 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.logout-btn {
    background: #dc3545;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    display: inline-block;
}
.logout-btn:hover { background: #c82333; transform: translateY(-2px); }

/* ══════════════════════════════
   MELDUNGEN
══════════════════════════════ */
.success, .error {
    padding: 20px;
    margin-bottom: 25px;
    border-radius: 10px;
    font-weight: 600;
}
.success { background: #4d5645; color: #fff; border: 2px solid #4d5645; }
.error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ══════════════════════════════
   SEKTIONEN
══════════════════════════════ */
.form-section, .events-section {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    margin-bottom: 35px;
}

/* ══════════════════════════════
   FORMULAR
══════════════════════════════ */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}
.form-group { display: flex; flex-direction: column; }
.form-group.full-width { grid-column: 1 / -1; }

.form-group label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
    font-size: 0.95rem;
}
.form-group input,
.form-group textarea,
.form-group select {
    padding: 15px 18px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
    background: #fafbfc;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #4d5645;
    background: white;
    box-shadow: 0 0 0 4px rgba(77,86,69,0.1);
}

input[type="file"] {
    padding: 10px;
    font-size: 14px;
}

button[type="submit"] {
    background: #4d5645;
    color: white;
    padding: 18px 35px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
}
button[type="submit"]:hover {
    background: #3e4a38;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(77,86,69,0.3);
}

.save-order-btn {
    background: #28a745;
    max-width: 300px;
    margin: 20px auto 0;
    display: block;
}
.save-order-btn:hover { background: #218838; }

/* ══════════════════════════════
   DATUM-TYP TABS
══════════════════════════════ */
.date-type-tabs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.date-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    background: #fafbfc;
    transition: all 0.2s;
    user-select: none;
}
.date-tab input[type="radio"] { display: none; }
.date-tab:hover { border-color: #4d5645; background: #f0f4ee; }
.date-tab.active {
    border-color: #4d5645;
    background: #4d5645;
    color: white;
    box-shadow: 0 4px 12px rgba(77,86,69,0.25);
}

.date-fields-panel {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════
   MEHRERE TAGE
══════════════════════════════ */
#multi-days-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 18px;
}
.multi-day-row {
    background: white;
    border: 1.5px solid #e1e5e9;
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.multi-day-row:hover { border-color: #4d5645; }

.multi-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f0f4ee;
    border-bottom: 1.5px solid #e1e5e9;
    padding: 10px 18px;
}
.multi-day-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: #4d5645;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.multi-day-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    padding: 20px;
}
.multi-day-fields .form-group { margin: 0; }

.remove-day-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.remove-day-btn:hover { background: #c82333; transform: scale(1.1); }

.add-day-btn {
    background: transparent;
    color: #4d5645;
    border: 2px dashed #4d5645;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: auto;
    text-transform: none;
    letter-spacing: 0;
    transition: all 0.2s;
}
.add-day-btn:hover { background: #4d5645; color: white; transform: none; box-shadow: none; }

/* ══════════════════════════════
   BILD VORSCHAU
══════════════════════════════ */
.image-preview,
.existing-preview,
#imagePreview,
#existingImagePreview {
    position: relative;
    width: 140px;
    height: 90px;
    margin-top: 12px;
    border: 3px dashed #ddd;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(45deg, #f0f0f0, #e0e0e0);
    transition: all 0.3s;
    cursor: pointer;
    max-width: 100%;
    box-sizing: border-box;
}
.image-preview:hover,
.existing-preview:hover,
#imagePreview:hover,
#existingImagePreview:hover {
    border-color: #4d5645;
    transform: scale(1.03);
    box-shadow: 0 5px 15px rgba(77,86,69,0.2);
}
.image-preview img,
.existing-preview img,
#imagePreview img,
#existingImagePreview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}
.remove-preview {
    position: absolute;
    top: 5px; right: 5px;
    background: #dc3545;
    color: white;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center; justify-content: center;
    font-size: 14px; cursor: pointer; font-weight: bold;
}

/* ══════════════════════════════
   RADIO GRUPPE
══════════════════════════════ */
.radio-group { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.radio-group label {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; padding: 6px 10px;
    border-radius: 8px; transition: background 0.2s;
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 0;
    width: fit-content;
}
.radio-group label input[type="radio"] {
    width: auto;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}
.radio-group label:hover { background: #f8f9fa; }

/* ══════════════════════════════
   TERMINLISTE
══════════════════════════════ */
.events-list { list-style: none; padding: 0; }

.event-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    transition: all 0.3s;
}
.event-item:hover {
    border-color: #4d5645;
    box-shadow: 0 8px 25px rgba(77,86,69,0.15);
    transform: translateY(-3px);
}

.event-preview {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    min-width: 0;
}

.order-input { flex-shrink: 0; }
.order-input input {
    width: 60px; padding: 10px;
    font-weight: bold; text-align: center;
    border: 2px solid #ddd; border-radius: 8px; background: white;
}

.image-thumb {
    width: 80px; height: 80px;
    border-radius: 12px; overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.image-thumb img {
    width: 100%; height: 100%;
    object-fit: cover; transition: transform 0.3s;
}
.image-thumb:hover img { transform: scale(1.1); }

.preview-content { flex: 1; min-width: 0; }
.preview-content strong {
    font-size: 1.2rem; color: #2c3e50;
    margin-bottom: 6px; display: block;
}

/* DATUM / ORT BADGES */
.event-datetime {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 7px 0 10px 0;
}
.event-multiday-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 0;
    border-bottom: 1px dashed #e0d5c0;
}
.event-multiday-row:last-child { border-bottom: none; }

.event-info-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 1.5px solid #d4bc8a;
    color: #7a6030;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(186,154,91,0.10);
}
.event-info-badge.addr {
    border-color: #c8d0c4;
    color: #4d5645;
    background: #f4f6f3;
}

.event-snippet {
    font-size: 0.95rem; color: #666;
    margin-bottom: 10px; line-height: 1.5;
}
.event-meta {
    font-size: 0.85rem; color: #999;
    background: #f0f8ff;
    padding: 6px 12px; border-radius: 20px; display: inline-block;
}

.event-actions {
    flex-shrink: 0;
    padding-left: 15px;
    border-left: 2px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.delete-btn {
    background: #dc3545; color: white;
    padding: 12px 18px; border: none;
    text-decoration: none; border-radius: 8px;
    font-size: 14px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 5px;
    cursor: pointer; transition: all 0.3s;
}
.delete-btn:hover {
    background: #c82333; transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220,53,69,0.3);
}

.empty-state {
    text-align: center; padding: 60px 40px;
    color: #666; background: #f8f9fa;
    border-radius: 15px; border: 2px dashed #dee2e6;
}

/* ══════════════════════════════
   BEARBEITEN / ABBRECHEN
══════════════════════════════ */
.edit-btn-small {
    background: #007bff; color: white;
    padding: 12px 16px; text-decoration: none;
    border-radius: 8px; font-size: 14px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 5px;
    transition: all 0.3s;
}
.edit-btn-small:hover {
    background: #0056b3; transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,123,255,0.3);
}
.cancel-btn {
    background: #6c757d; color: white;
    padding: 18px 35px; text-decoration: none;
    border-radius: 10px; font-size: 16px; font-weight: 600;
    transition: all 0.3s; flex: 1; text-align: center;
    display: inline-block;
}
.cancel-btn:hover { background: #545b62; transform: translateY(-2px); }
.edit-btn { background: #007bff; flex: 1; }

/* ══════════════════════════════
   RESPONSIVE
══════════════════════════════ */
@media (max-width: 1200px) {
    .form-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .admin-container { padding: 20px 15px; }
    .form-row { grid-template-columns: 1fr; }
    .form-section, .events-section { padding: 25px; }

    .event-item { flex-direction: column; }
    .event-preview { flex-direction: column; }
    .event-actions {
        border-left: none;
        border-top: 2px solid #eee;
        padding: 15px 0 0 0;
        flex-direction: row;
    }

    .date-type-tabs { flex-direction: column; }
    .multi-day-fields { grid-template-columns: 1fr; }

    .event-info-badge { font-size: 0.78rem; }

    /* Bildvorschau auf Mobile volle Breite */
    .image-preview,
    .existing-preview,
    #imagePreview,
    #existingImagePreview {
        width: 100%;
        height: 160px;
    }
}

@media (max-width: 600px) {
    /* Header: Logout oben, Titel darunter */
    header {
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 12px;
    }
    header h1 { font-size: 1.2rem; }
    header form { align-self: flex-end; }

    .logout-btn {
        padding: 10px 18px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .login-container { margin: 20px; padding: 40px 25px; }
}