/* ============================================
   JavaScript-Komponenten CSS
   public/assets/css/components.css
   ============================================ */

/* ----- Autocomplete ----- */
.autocomplete-container {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f5;
    transition: background 0.2s;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: #f0f7ff;
}

.autocomplete-empty {
    padding: 15px;
    text-align: center;
    color: #6c757d;
}

/* ----- Search Results ----- */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.search-result {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f5;
    transition: background 0.2s;
}

.search-result:hover {
    background: #f0f7ff;
}

.search-result .result-name {
    font-weight: 500;
}

.search-result .result-details {
    font-size: 13px;
    color: #6c757d;
}

.search-empty {
    padding: 15px;
    text-align: center;
    color: #6c757d;
}

/* ----- Tooltips ----- */
.tooltip-popup {
    position: fixed;
    padding: 6px 12px;
    background: #2c3e50;
    color: #fff;
    border-radius: 4px;
    font-size: 13px;
    z-index: 10000;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.tooltip-popup::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #2c3e50;
}

/* ----- Modals ----- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    overflow-y: auto;
    padding: 20px;
}

.modal.active {
    display: block;
}

.modal-content {
    background: #fff;
    max-width: 600px;
    margin: 50px auto;
    border-radius: 8px;
    padding: 30px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    border: none;
    background: none;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

.modal-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
}

.modal-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ----- Dynamic Forms ----- */
.dynamic-form .field-row {
    display: flex;
    gap: 10px;
    align-items: end;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 10px;
}

.dynamic-form .field-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.dynamic-form .remove-field {
    flex-shrink: 0;
}

/* ----- File Upload ----- */
.file-upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s;
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: #3498db;
}

.file-upload-area .upload-icon {
    font-size: 48px;
    color: #6c757d;
}

.file-upload-area .upload-text {
    margin-top: 10px;
    color: #6c757d;
}

.file-upload-area input[type="file"] {
    display: none;
}

.preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.preview-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 150px;
}

.preview-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

.preview-item .file-icon {
    font-size: 32px;
}

.preview-item .file-name {
    font-size: 13px;
    flex: 1;
    word-break: break-all;
}

.preview-item .file-size {
    font-size: 12px;
    color: #6c757d;
}

/* ----- Form Steps ----- */
.form-steps .step {
    display: none;
}

.form-steps .step.active {
    display: block;
}

.form-steps .step-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    position: relative;
}

.form-steps .step-progress::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #e9ecef;
    z-index: 0;
}

.form-steps .step-progress .step-indicator {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.form-steps .step-progress .step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: all 0.3s;
}

.form-steps .step-progress .step-number.active {
    background: #3498db;
    color: #fff;
}

.form-steps .step-progress .step-number.completed {
    background: #2ecc71;
    color: #fff;
}

.form-steps .step-progress .step-label {
    font-size: 12px;
    color: #6c757d;
    text-align: center;
}

.form-steps .progress-bar {
    height: 4px;
    background: #3498db;
    transition: width 0.3s;
}

/* ----- Notification Badge ----- */
.notification-badge {
    position: relative;
    display: inline-block;
}

.notification-badge .badge-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: #fff;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 11px;
    min-width: 18px;
    text-align: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ----- Activity Feed ----- */
.activity-feed {
    max-height: 400px;
    overflow-y: auto;
}

.feed-item {
    display: flex;
    gap: 15px;
    padding: 10px 15px;
    border-bottom: 1px solid #f1f3f5;
    align-items: center;
}

.feed-item .feed-time {
    font-size: 12px;
    color: #6c757d;
    min-width: 90px;
}

.feed-item .feed-icon {
    font-size: 18px;
}

.feed-item .feed-content {
    flex: 1;
}

/* ----- Quick Stats ----- */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.quick-stat {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    text-align: center;
}

.quick-stat .stat-value {
    font-size: 24px;
    font-weight: 600;
}

.quick-stat .stat-label {
    font-size: 13px;
    color: #6c757d;
    margin-top: 5px;
}

/* ----- Responsive Adjustments ----- */
@media (max-width: 768px) {
    .dynamic-form .field-row {
        flex-direction: column;
        gap: 10px;
    }

    .dynamic-form .field-row .form-group {
        width: 100%;
    }

    .form-steps .step-progress .step-label {
        display: none;
    }

    .quick-stats {
        grid-template-columns: 1fr 1fr;
    }

    .preview-item {
        min-width: 100%;
    }
}

/* ----- Loading Spinner ----- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ----- Badge Animations ----- */
.badge-pulse {
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* ----- Form Validation States ----- */
.form-group .error-message {
    display: none;
    color: #dc3545;
    font-size: 13px;
    margin-top: 5px;
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: #dc3545;
}

.form-group input.error:focus,
.form-group select.error:focus,
.form-group textarea.error:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}