/**
 * Main Stylesheet
 */

/* Base Styles */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    --background-color: #f5f5f5;
    --header-height: 60px;
    --detail-panel-width: 360px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

/* Top Navigation */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--primary-color);
    color: white;
    padding: 0 1rem;
    height: var(--header-height);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1000;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: bold;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.username {
    font-weight: 500;
}

.logout-btn {
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Main Container */
.app-container {
    height: calc(100vh - var(--header-height));
    width: 100%;
    display: flex;
    position: relative;
    overflow: hidden;
}

/* Detail Panel */
.detail-panel {
    width: var(--detail-panel-width);
    max-width: var(--detail-panel-width);
    height: 100%;
    background-color: white;
    border-left: 1px solid var(--border-color);
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.05);
    padding: 1rem;
    overflow-y: auto;
    display: none;
    animation: slide-in 0.3s ease-out;
    z-index: 100;
    position: absolute;
    right: 0;
    top: 0;
}

@keyframes slide-in {
    from {
        transform: translateX(360px);
    }
    to {
        transform: translateX(0);
    }
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 280px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--secondary-color);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--dark-color);
}

.detail-content {
    margin-bottom: 1rem;
}

.detail-content p {
    margin-bottom: 0.75rem;
}

.detail-files {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-control-file {
    display: block;
    width: 100%;
}

/* Buttons */
.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, 
                border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    cursor: pointer;
}

.btn:focus, .btn:hover {
    text-decoration: none;
}

.btn:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.btn-primary {
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #0069d9;
    border-color: #0062cc;
}

.btn-secondary {
    color: #fff;
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

.btn-danger {
    color: #fff;
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.2rem;
}

.btn-block {
    display: block;
    width: 100%;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Upload Progress */
.upload-progress {
    margin-top: 0.5rem;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.3s;
}

/* File Lists */
.file-list {
    margin: 0.5rem 0;
    padding: 0;
    list-style: none;
}

.file-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.file-list li:last-child {
    border-bottom: none;
}

.file-list a {
    color: var(--primary-color);
    text-decoration: none;
}

.file-list a:hover {
    text-decoration: underline;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.file-item:last-child {
    border-bottom: none;
}

.file-delete-btn {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.file-delete-btn:hover {
    background-color: rgba(220, 53, 69, 0.1);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    padding-top: 60px;
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #888;
    border-radius: 0.3rem;
    width: 80%;
    max-width: 600px;
    animation: modal-show 0.3s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

@keyframes modal-show {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-body {
    padding: 1rem;
    max-height: 70vh;
    overflow-y: auto;
}

/* Filter Styles */
.filter-group {
    margin-bottom: 1.5rem;
}

.filter-actions {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-item {
    margin-bottom: 0.5rem;
}

.filter-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.filter-item input[type="checkbox"] {
    margin-right: 0.5rem;
}

.checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
}

.color-indicator {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 350px;
}

.toast {
    display: flex !important; /* Wichtig, um Bootstrap-Standardverhalten zu überschreiben */
    align-items: center !important;
    background: white;
    padding: 10px 15px !important;
    border-radius: 4px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s, transform 0.3s;
    min-height: auto !important;
    max-height: none !important;
    width: 100% !important;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-error {
    border-left: 4px solid var(--danger-color);
}

.toast-warning {
    border-left: 4px solid var(--warning-color);
}

.toast-info {
    border-left: 4px solid var(--info-color);
}

.toast-icon {
    margin-right: 10px !important;
    font-size: 1.25rem !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.toast-success .toast-icon {
    color: var(--success-color);
}

.toast-error .toast-icon {
    color: var(--danger-color);
}

.toast-warning .toast-icon {
    color: var(--warning-color);
}

.toast-info .toast-icon {
    color: var(--info-color);
}

.toast-content {
    flex: 1;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1.4 !important;
}

.toast-close {
    background: none !important;
    border: none !important;
    font-size: 1.25rem !important;
    cursor: pointer !important;
    color: #aaa !important;
    margin-left: 10px !important;
    padding: 0 !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.toast-close:hover {
    color: #333 !important;
}

/* User Badge */
.user-badge {
    background-color: rgba(0, 123, 255, 0.8);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

select:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background-color: #f8f9fa;
}

/* Responsive Styles */
@media (max-width: 768px) {    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .button-group {
        flex-wrap: wrap;
    }
    
    .button-group .btn {
        flex: 1 0 40%;
    }
    
    .checkboxes {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .toast-container {
        top: 10px;
        right: 10px;
    }
    
    .toast {
        max-width: calc(100vw - 20px);
    }
}

/* Add these new styles at the end of styles.css */

/* Enhanced styles for the detail panel */
.detail-panel {
    width: var(--detail-panel-width);
    max-width: var(--detail-panel-width);
    height: 100%;
    background-color: white;
    border-left: 1px solid var(--border-color);
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.05);
    padding: 1rem;
    overflow-y: auto;
    display: none;
    animation: slide-in 0.3s ease-out;
    z-index: 100;
    position: absolute;
    right: 0;
    top: 0;
}

/* Minimized panel for mobile map interaction */
.detail-panel.minimized {
    height: auto;
    max-height: 60px;
    overflow: hidden;
    padding: 10px;
    opacity: 0.8;
    bottom: 0;
    top: auto;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
    text-align: center;
}

.restore-panel {
    text-align: center;
    padding: 5px;
    background: rgba(0,0,0,0.05);
    cursor: pointer;
    border-radius: 4px;
}

.restore-panel:hover {
    background: rgba(0,0,0,0.1);
}

/* Disabled select styling */
select:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background-color: #f8f9fa;
}

/* Ensure panel transition is smooth */
.detail-panel {
    transition: all 0.3s ease;
}

/* Fix panel positioning on mobile */
@media (max-width: 768px) {
    .detail-panel {
        transition: all 0.3s ease-out;
        width: 100% !important;
        max-width: 100% !important;
        left: 0;
        right: 0;
        z-index: 1000;
    }
    
    .detail-panel.minimized {
        position: fixed;
        height: auto !important;
        max-height: 60px !important;
        bottom: 0 !important;
        top: auto !important;
        background-color: rgba(255, 255, 255, 0.95);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
        border-radius: 10px 10px 0 0;
        border: 1px solid #ddd;
        padding: 10px;
    }
    
    .restore-panel {
        font-size: 14px;
        padding: 8px 0;
        margin: 0 auto;
        background: rgba(0,0,0,0.05);
        border-radius: 15px;
        width: 80%;
        text-align: center;
        cursor: pointer;
        user-select: none;
        -webkit-user-select: none;
        touch-action: manipulation;
    }
    
    .restore-panel:active {
        background: rgba(0,0,0,0.1);
    }
}

/* === Mobile Panel Styles === */
.detail-panel {
    transition: all 0.25s ease;
}

/* Block all transitions when restoring is happening */
.detail-panel.restoring {
    transition: none !important;
}

/* Enhanced styles for the detail panel */
.detail-panel.minimized {
    height: auto !important;
    max-height: 60px !important;
    overflow: hidden !important;
    padding: 10px !important;
    opacity: 0.9 !important;
    bottom: 0 !important;
    top: auto !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    border-bottom: 0 !important;
    border-radius: 10px 10px 0 0 !important;
    text-align: center !important;
    position: fixed !important;
    z-index: 9999 !important;
    background-color: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15) !important;
}

.restore-panel {
    text-align: center;
    padding: 5px;
    background: rgba(0,0,0,0.05);
    cursor: pointer;
    border-radius: 4px;
    margin: 5px auto;
    width: 80%;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    font-weight: bold;
}

.restore-panel:active {
    background: rgba(0,0,0,0.1);
}

/* Disabled select styling */
select:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background-color: #f8f9fa;
}

/* Fix for detail panels on mobile */
@media (max-width: 768px) {
    .detail-panel {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: auto !important;
        z-index: 1000 !important;
        background: #fff;
        overflow: auto !important;
    }
    
    /* Ensure forms aren't hidden inside panels */
    .detail-panel .row,
    .detail-panel .col,
    .detail-panel .form-group,
    .detail-panel input,
    .detail-panel textarea,
    .detail-panel select,
    .detail-panel button {
        max-width: 100%;
    }
    
    /* Button styling improvements on mobile */
    .detail-panel button {
        margin-bottom: 8px;
    }
    
    /* Help scrolling work better on mobile */
    .detail-panel {
        -webkit-overflow-scrolling: touch;
    }
}

/* Additional panel styling improvements */
.detail-panel {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.detail-panel button {
    margin-right: 5px;
}

/* Fix for buttons on mobile */
@media (max-width: 768px) {
    .detail-panel .btn-group {
        display: flex;
        flex-wrap: wrap;
    }
    
    .detail-panel .btn-group button {
        flex: 1 1 auto;
        margin-bottom: 5px;
    }
}

.line-edit-custom-btn {
    min-width: 100px !important;
    height: 40px !important;
    line-height: 40px !important;
    padding: 0 16px !important;
    font-size: 14px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    margin: 5px !important;
    text-align: center !important;
    display: inline-block !important;
    font-weight: 500 !important;
    box-sizing: border-box !important;
    font-family: sans-serif !important;
}

.line-edit-save-btn {
    background-color: #4CAF50 !important;
    color: white !important;
    border: none !important;
}

.line-edit-cancel-btn {
    background-color: #f44336 !important;
    color: white !important;
    border: none !important;
}