/**
 * Mühlentagebuch - Frontend Styles
 * @package Muehlentagebuch
 * @since 2.1.0
 */

/* KOMPONENTEN MANAGEMENT */
.komponenten-management { max-width: 1200px; margin: 20px auto; background: white; border-radius: 15px; padding: 30px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.komponenten-management h3 { color: #2c3e50; margin: 0 0 25px 0; font-size: 1.5em; text-align: center; padding-bottom: 15px; border-bottom: 2px solid #3498db; }
.komponenten-grid-management { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 20px; }
.komponente-card { background: #f8f9fa; border: 2px solid #e9ecef; border-radius: 12px; padding: 20px; transition: all 0.3s ease; }
.komponente-card:hover { border-color: #3498db; box-shadow: 0 5px 15px rgba(52,152,219,0.2); }
.komponente-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid #ecf0f1; }
.komponente-header h4 { margin: 0; color: #2c3e50; font-size: 1.2em; }
.komponente-status-indicators { display: flex; gap: 5px; }
.status-indicator { font-size: 18px; opacity: 0.8; }
.komponente-controls { display: grid; gap: 15px; }
.control-group { display: flex; align-items: center; }

/* TOGGLE SWITCHES */
.toggle-label { display: flex; align-items: center; cursor: pointer; font-weight: 500; width: 100%; padding: 8px; border-radius: 6px; transition: background-color 0.3s ease; }
.toggle-label:hover { background: rgba(52,152,219,0.1); }
.toggle-label input[type="checkbox"] { display: none; }
.toggle-slider { width: 50px; height: 24px; background: #ccc; border-radius: 12px; position: relative; margin-right: 12px; transition: all 0.3s ease; }
.toggle-slider::before { content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: white; top: 2px; left: 2px; transition: all 0.3s ease; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.toggle-label input[type="checkbox"]:checked + .toggle-slider { background: #3498db; }
.toggle-label input[type="checkbox"]:checked + .toggle-slider::before { transform: translateX(26px); }
.toggle-label.freigabe input:checked + .toggle-slider { background: #27ae60; }
.toggle-label.in-betrieb input:checked + .toggle-slider { background: #3498db; }
.toggle-label.in-reparatur input:checked + .toggle-slider { background: #e67e22; }
.toggle-label.undefiniert input:checked + .toggle-slider { background: #95a5a6; }
.komponente-footer { margin-top: 15px; padding-top: 15px; border-top: 1px solid #ecf0f1; text-align: center; color: #7f8c8d; }
.komponenten-message { margin-top: 20px; padding: 15px; border-radius: 8px; font-weight: 600; text-align: center; display: none; }
.komponenten-message.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.komponenten-message.error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* LOGIN FORMULAR */
.muehlentagebuch-login-container { max-width: 400px; margin: 40px auto; padding: 30px; background: white; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.muehlentagebuch-login-container h3 { text-align: center; color: #2c3e50; margin: 0 0 25px 0; font-size: 1.5em; }
.muehlentagebuch-login-form .form-group { margin-bottom: 20px; }
.muehlentagebuch-login-form label { display: block; margin-bottom: 8px; font-weight: 500; color: #555; }
.muehlentagebuch-login-form input[type="text"],
.muehlentagebuch-login-form input[type="password"] { width: 100%; padding: 12px 15px; border: 2px solid #e9ecef; border-radius: 8px; font-size: 15px; transition: border-color 0.3s ease; box-sizing: border-box; }
.muehlentagebuch-login-form input:focus { outline: none; border-color: #3498db; }
.muehlentagebuch-login-form .btn-login { width: 100%; padding: 14px; background: linear-gradient(135deg, #3498db, #2980b9); color: white; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; }
.muehlentagebuch-login-form .btn-login:hover { background: linear-gradient(135deg, #2980b9, #1c5985); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(52,152,219,0.3); }
.muehlentagebuch-login-form .btn-login:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.muehlentagebuch-login-status { max-width: 400px; margin: 20px auto; padding: 20px; background: #d4edda; border-radius: 10px; text-align: center; }
.muehlentagebuch-login-status p { margin: 0 0 15px 0; color: #155724; }
.muehlentagebuch-login-status .btn-logout { background: #e74c3c; color: white; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-weight: 500; }
.muehlentagebuch-login-status .btn-logout:hover { background: #c0392b; }
.login-error { background: #f8d7da; color: #721c24; padding: 12px; border-radius: 6px; margin-bottom: 15px; text-align: center; display: none; }

/* EINTRAG DETAIL */
.muehlentagebuch-entry-detail { max-width: 900px; margin: 20px auto; background: white; border-radius: 15px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); overflow: hidden; }
.entry-detail-header { background: linear-gradient(135deg, #3498db, #2980b9); color: white; padding: 25px 30px; }
.entry-detail-header h2 { margin: 0 0 10px 0; font-size: 1.5em; }
.entry-detail-meta { display: flex; gap: 20px; flex-wrap: wrap; font-size: 14px; opacity: 0.9; }
.entry-detail-content { padding: 30px; }
.entry-detail-section { margin-bottom: 25px; padding-bottom: 25px; border-bottom: 1px solid #eee; }
.entry-detail-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.entry-detail-section h3 { color: #2c3e50; margin: 0 0 15px 0; font-size: 1.1em; display: flex; align-items: center; gap: 10px; }
.entry-type-badge { display: inline-block; padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; background: rgba(255,255,255,0.2); }

/* EINTRAG FORMULAR */
.muehlentagebuch-entry-form { max-width: 800px; margin: 20px auto; background: white; border-radius: 15px; padding: 30px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
.muehlentagebuch-entry-form h3 { color: #2c3e50; margin: 0 0 25px 0; padding-bottom: 15px; border-bottom: 2px solid #3498db; text-align: center; }
.form-section { margin-bottom: 25px; }
.form-section-title { font-weight: 600; color: #2c3e50; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid #eee; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 15px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: #555; }
.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="number"],
.form-group select,
.form-group textarea { width: 100%; padding: 10px 12px; border: 2px solid #e9ecef; border-radius: 8px; font-size: 14px; transition: border-color 0.3s ease; box-sizing: border-box; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: #3498db; }
.form-group textarea { min-height: 120px; resize: vertical; }
.checkbox-group, .radio-group { display: flex; flex-wrap: wrap; gap: 15px; }
.checkbox-item, .radio-item { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-item input, .radio-item input { width: auto; }

/* BILD UPLOAD */
.image-upload-area { border: 2px dashed #ccc; border-radius: 10px; padding: 30px; text-align: center; cursor: pointer; transition: all 0.3s ease; }
.image-upload-area:hover { border-color: #3498db; background: rgba(52,152,219,0.05); }
.image-upload-area.dragover { border-color: #27ae60; background: rgba(39,174,96,0.1); }
.image-preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-top: 15px; }
.image-preview-item { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; }
.image-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-item .remove-image { position: absolute; top: 5px; right: 5px; background: #e74c3c; color: white; border: none; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; font-size: 14px; }

/* SUBMIT */
.form-submit { margin-top: 30px; padding-top: 20px; border-top: 2px solid #eee; text-align: center; }
.btn-submit { display: inline-flex; align-items: center; gap: 10px; padding: 15px 40px; background: linear-gradient(135deg, #27ae60, #219a52); color: white; border: none; border-radius: 10px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; }
.btn-submit:hover { background: linear-gradient(135deg, #219a52, #1e8449); transform: translateY(-2px); box-shadow: 0 5px 20px rgba(39,174,96,0.3); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* BILDER GALERIE */
.bilder-galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; margin-top: 15px; }
.bild-item { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,0.1); transition: transform 0.3s ease; }
.bild-item:hover { transform: scale(1.05); }
.bild-item img { width: 100%; height: 100%; object-fit: cover; }
.bild-overlay { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,0.7)); color: white; padding: 10px; font-size: 12px; opacity: 0; transition: opacity 0.3s ease; }
.bild-item:hover .bild-overlay { opacity: 1; }

/* LIGHTBOX */
.image-lightbox { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.95); z-index: 99999; align-items: center; justify-content: center; padding: 20px; }
.image-lightbox.active { display: flex; }
.lightbox-content { max-width: 90vw; max-height: 90vh; position: relative; }
.lightbox-content img { max-width: 100%; max-height: 85vh; border-radius: 5px; }
.lightbox-close { position: absolute; top: -40px; right: 0; background: none; border: none; color: white; font-size: 30px; cursor: pointer; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.2); border: none; color: white; font-size: 24px; padding: 15px; cursor: pointer; border-radius: 5px; }
.lightbox-nav.prev { left: -60px; }
.lightbox-nav.next { right: -60px; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; padding: 12px 24px; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, #3498db, #2980b9); color: white; }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #2980b9, #1c5985); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(52,152,219,0.3); }
.btn-secondary { background: #95a5a6; color: white; }
.btn-secondary:hover:not(:disabled) { background: #7f8c8d; }
.btn-success { background: linear-gradient(135deg, #27ae60, #219a52); color: white; }
.btn-success:hover:not(:disabled) { background: linear-gradient(135deg, #219a52, #1e8449); }
.btn-danger { background: #e74c3c; color: white; }
.btn-danger:hover:not(:disabled) { background: #c0392b; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* MESSAGES */
.message-box { padding: 15px 20px; border-radius: 8px; margin: 15px 0; display: flex; align-items: center; gap: 10px; }
.message-box.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.message-box.error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.message-box.warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.message-box.info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ANIMATIONS */
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.unsaved-indicator { margin-left: 15px; color: #e74c3c; font-weight: 600; animation: pulse 2s infinite; }
.loading-spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 1s linear infinite; }

/* ========================================
   ENTRY DETAIL MODAL
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay .modal-content {
    background: white;
    border-radius: 15px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-overlay .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px 15px 0 0;
}

.modal-overlay .modal-header h3 {
    margin: 0;
    font-size: 1.3em;
}

.modal-overlay .modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 28px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.modal-overlay .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-overlay .modal-body {
    padding: 25px;
}

.modal-overlay .modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f8f9fa;
    border-radius: 0 0 15px 15px;
}

/* Detail Sections */
.detail-status-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.detail-status-bar span {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.type-badge-large { background: #e3f2fd; color: #1976d2; }
.type-badge-large.type-Logbuch { background: #e8f5e9; color: #388e3c; }
.type-badge-large.type-Idee { background: #fff3e0; color: #f57c00; }
.type-badge-large.type-ToDo { background: #e3f2fd; color: #1976d2; }
.type-badge-large.type-Event { background: #fce4ec; color: #c2185b; }

.status-badge-large { padding: 6px 12px; border-radius: 20px; }
.status-badge-large.status-einsatzbereit { background: #d4edda; color: #155724; }
.status-badge-large.status-eingeschraenkt_einsatzbereit { background: #fff3cd; color: #856404; }
.status-badge-large.status-nicht_einsatzbereit { background: #f8d7da; color: #721c24; }

.erledigt-badge-large { background: #d4edda; color: #155724; }
.offen-badge-large { background: #f8d7da; color: #721c24; }
.mahlbetrieb-badge-large { background: #fff3cd; color: #856404; }

.detail-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.detail-section h4 {
    color: #2c3e50;
    margin: 0 0 15px 0;
    font-size: 1.1em;
}

.kurzbeschreibung {
    font-size: 1.1em;
    color: #2c3e50;
    margin: 0 0 10px 0;
}

.langbeschreibung {
    color: #555;
    line-height: 1.6;
}

/* Bilder Galerie im Modal */
.bilder-galerie {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.bild-thumbnail {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1;
    background: #f0f0f0;
}

.bild-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.bild-thumbnail:hover img {
    transform: scale(1.1);
}

.bild-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.bild-thumbnail:hover .bild-overlay {
    opacity: 1;
}

.bild-icon {
    font-size: 24px;
}

/* Korn Grid */
.korn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.korn-entry-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    border-left: 4px solid #f39c12;
}

.korn-entry-card.roggen { border-left-color: #8b4513; }
.korn-entry-card.weizen { border-left-color: #daa520; }
.korn-entry-card.dinkel { border-left-color: #cd853f; }

/* Meta Info */
.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-top: 20px;
}

.meta-row {
    display: flex;
    gap: 8px;
}

.meta-label {
    color: #666;
}

.meta-value {
    font-weight: 600;
    color: #2c3e50;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e9ecef;
    color: #495057;
}

.btn-secondary:hover {
    background: #dee2e6;
}

/* Body mit Modal offen */
body.modal-open {
    overflow: hidden;
}

/* Image Modal */
.image-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.image-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

.image-modal-content img {
    max-width: 100%;
    max-height: 80vh;
    display: block;
}

/* RESPONSIVE */
@media screen and (max-width: 768px) {
    .komponenten-management { padding: 20px; margin: 10px; border-radius: 10px; }
    .komponenten-grid-management { grid-template-columns: 1fr; }
    .muehlentagebuch-login-container { margin: 20px; padding: 20px; }
    .muehlentagebuch-entry-form { margin: 10px; padding: 20px; }
    .form-row { grid-template-columns: 1fr; }
    .entry-detail-meta { flex-direction: column; gap: 10px; }
    .bilder-galerie { grid-template-columns: repeat(2, 1fr); }
}
@media screen and (max-width: 480px) {
    .komponente-card { padding: 15px; }
    .toggle-slider { width: 44px; height: 22px; }
    .toggle-slider::before { width: 18px; height: 18px; }
    .toggle-label input[type="checkbox"]:checked + .toggle-slider::before { transform: translateX(22px); }
    .bilder-galerie { grid-template-columns: 1fr; }
}
