/**
 * Reparaturformular Styles V2
 * S-TechSMD Repair Centre
 *
 * Modernes Multi-Step Formular mit Cards, Drag & Drop etc.
 */

/* ===== Form Wizard Container ===== */
.form-wizard {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow);
    padding: 32px;
    max-width: 900px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .form-wizard {
        padding: 20px;
    }
}

/* ===== Wizard Steps Progress ===== */
.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    position: relative;
}

.wizard-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 60px;
    right: 60px;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.wizard-step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--light-bg);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-light);
    transition: all 0.3s;
}

.wizard-step.active .wizard-step-number {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.wizard-step.completed .wizard-step-number {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.wizard-step.completed .wizard-step-number::after {
    content: '\2713';
}

.wizard-step-title {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    text-align: center;
}

.wizard-step.active .wizard-step-title {
    color: var(--primary-color);
    font-weight: 600;
}

.wizard-step.completed .wizard-step-title {
    color: var(--success);
}

@media (max-width: 600px) {
    .wizard-step-title {
        display: none;
    }

    .wizard-steps::before {
        left: 30px;
        right: 30px;
    }
}

/* ===== Progress Bar ===== */
.wizard-progress {
    height: 4px;
    background: var(--light-bg);
    border-radius: 4px;
    margin-bottom: 32px;
    overflow: hidden;
}

.wizard-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #0099ff);
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* ===== Wizard Panels ===== */
.wizard-panel {
    display: none;
}

.wizard-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.wizard-panel-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 24px;
    text-align: center;
}

/* ===== Category Cards ===== */
.category-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.category-card {
    background: var(--light-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.category-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.category-card.selected {
    border-color: var(--primary-color);
    background: rgba(0, 102, 204, 0.05);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2);
}

.category-card-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

/* Category Card Image */
.category-card-image {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    overflow: hidden;
    border-radius: var(--border-radius);
    background-color: #fff;
}

.category-card-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.category-card-img-default {
    max-width: 60px;
    max-height: 60px;
    opacity: 0.5;
}

.category-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.category-card-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ===== Unit Selection Fields ===== */
.unit-selection-group {
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

.unit-selection-group.hidden {
    display: none;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 200px; }
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.form-label.required::after {
    content: ' *';
    color: var(--danger);
}

.form-control,
.form-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: white;
    transition: all 0.2s;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--danger);
}

.form-control::placeholder {
    color: var(--text-light);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.form-help {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ===== Error Codes ===== */
.error-codes-container {
    margin-bottom: 12px;
}

.error-code-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
}

.error-code-row .form-select {
    flex: 2;
}

.error-code-row .form-control {
    flex: 1;
}

.error-code-row .btn-icon {
    flex-shrink: 0;
}

/* ===== File Upload Zone ===== */
.file-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--light-bg);
}

.file-upload-zone:hover,
.file-upload-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(0, 102, 204, 0.05);
}

.file-upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.file-upload-text {
    font-size: 15px;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.file-upload-browse {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: underline;
}

.file-upload-hint {
    font-size: 12px;
    color: var(--text-light);
}

.file-input-hidden {
    display: none;
}

/* ===== File Preview List ===== */
.file-preview-list {
    margin-top: 16px;
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--light-bg);
    border-radius: var(--border-radius);
    margin-bottom: 8px;
}

.file-preview-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.file-preview-info {
    flex: 1;
    min-width: 0;
}

.file-preview-name {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-size {
    font-size: 12px;
    color: var(--text-light);
}

.file-preview-remove {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--border-radius);
    transition: all 0.2s;
}

.file-preview-remove:hover {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger);
}

/* ===== Checkbox & Radio ===== */
.checkbox-label,
.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-dark);
    padding: 8px 0;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

/* ===== Form Notice ===== */
.form-notice {
    background: rgba(0, 102, 204, 0.05);
    border-left: 4px solid var(--primary-color);
    padding: 16px 20px;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    margin-top: 24px;
}

.form-notice p {
    font-size: 14px;
    color: var(--text-dark);
    margin: 0;
}

.form-notice a {
    color: var(--primary-color);
}

/* ===== Wizard Actions ===== */
.wizard-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

#prevBtn {
    display: none;
}

#submitBtn {
    display: none;
}

/* ===== Success Container ===== */
.success-container {
    text-align: center;
    padding: 60px 20px;
}

.success-container.hidden {
    display: none;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    font-size: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 8px 24px rgba(40, 167, 69, 0.3);
}

.success-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.success-ticket {
    font-size: 18px;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.success-ticket strong {
    font-size: 24px;
    color: var(--primary-color);
    font-family: monospace;
    letter-spacing: 1px;
}

.success-text {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 32px;
}

.success-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* ===== Button Styles ===== */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--light-bg);
}

.btn-icon.btn-danger:hover {
    background: rgba(220, 53, 69, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

/* ===== Dynamic Field Grid System ===== */
.dynamic-fields-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.dynamic-fields-grid:empty {
    display: none;
}

.form-col-1  { flex: 0 0 calc(8.333333% - 14px); max-width: calc(8.333333% - 14px); }
.form-col-2  { flex: 0 0 calc(16.666667% - 14px); max-width: calc(16.666667% - 14px); }
.form-col-3  { flex: 0 0 calc(25% - 12px); max-width: calc(25% - 12px); }
.form-col-4  { flex: 0 0 calc(33.333333% - 11px); max-width: calc(33.333333% - 11px); }
.form-col-5  { flex: 0 0 calc(41.666667% - 10px); max-width: calc(41.666667% - 10px); }
.form-col-6  { flex: 0 0 calc(50% - 8px); max-width: calc(50% - 8px); }
.form-col-7  { flex: 0 0 calc(58.333333% - 7px); max-width: calc(58.333333% - 7px); }
.form-col-8  { flex: 0 0 calc(66.666667% - 6px); max-width: calc(66.666667% - 6px); }
.form-col-9  { flex: 0 0 calc(75% - 4px); max-width: calc(75% - 4px); }
.form-col-10 { flex: 0 0 calc(83.333333% - 3px); max-width: calc(83.333333% - 3px); }
.form-col-11 { flex: 0 0 calc(91.666667% - 2px); max-width: calc(91.666667% - 2px); }
.form-col-12 { flex: 0 0 100%; max-width: 100%; }

@media (max-width: 768px) {
    [class^="form-col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ===== Toggle Switch Styles ===== */
.toggle-switch {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    gap: 12px;
    user-select: none;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 26px;
    background-color: #ccc;
    border-radius: 26px;
    transition: background-color 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-color, #3b82f6);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.toggle-label {
    font-size: 14px;
    color: var(--text-dark);
}

/* ===== File Input Styles ===== */
.file-input-wrapper {
    position: relative;
}

.file-input-wrapper input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    background: var(--light-bg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-input-wrapper input[type="file"]:hover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
}

.file-input-wrapper input[type="file"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* ===== Preloaded Asset Banner ===== */
.preloaded-asset-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: var(--border-radius);
    margin-bottom: 24px;
}

.preloaded-asset-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.preloaded-asset-info {
    font-size: 14px;
    color: var(--text-dark);
    line-height: 1.4;
}

.preloaded-asset-info strong {
    color: #2563eb;
}

@media (max-width: 480px) {
    .preloaded-asset-banner {
        flex-direction: column;
        text-align: center;
        padding: 12px;
    }
}
