/**
 * SG Workflow - Detail Page Styles
 */

/* Container */
.sg-workflow-detail {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Header */
.workflow-header {
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.workflow-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.workflow-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.workflow-title {
    font-size: 28px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.pdf-export-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pdf-export-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.pdf-export-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.workflow-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

/* CC-Textzeile immer in eigener Zeile, Button hinter den Benutzernamen */
.workflow-meta .meta-item-cc {
    flex-basis: 100%;
    align-items: center;
    flex-wrap: nowrap;
}

.workflow-meta .meta-item-cc .sg-workflow-cc-edit-btn {
    margin-left: 10px;
    flex-shrink: 0;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.meta-label {
    font-weight: 600;
    color: #6c757d;
    font-size: 14px;
}

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

/* Badges */
.priority-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-low {
    background: #d4edda;
    color: #155724;
}

.priority-medium {
    background: #d1ecf1;
    color: #0c5460;
}

.priority-high {
    background: #fff3cd;
    color: #856404;
}

.priority-urgent {
    background: #f8d7da;
    color: #721c24;
    font-weight: 600;
}

.status-badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-new {
    background: #cce5ff;
    color: #004085;
}

.status-in_progress {
    background: #ffeaa7;
    color: #856404;
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

/* Content */
.workflow-content {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #d40000;
}

.content-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 16px;
}

.content-text {
    color: #495057;
    line-height: 1.6;
}

/* Sections */
.tasks-section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

/* Tasks Table */
.tasks-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.tasks-table th {
    background: #f8f9fa;
    color: #495057;
    font-weight: 600;
    padding: 15px 12px;
    text-align: left;
    border-bottom: 2px solid #e9ecef;
    font-size: 14px;
}

.tasks-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
}

.tasks-table td[data-col="comment"] {
    width: 40%;
}

.tasks-table tbody tr:last-child td {
    border-bottom: none;
}

/* Task Elements */
.toggle-explanation-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}

.toggle-explanation-btn:hover {
    background: #005a87;
}

.show-explanation-btn {
    margin-top: 8px;
    background: #007cba;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: block;
}

.show-explanation-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 124, 186, 0.3);
}

.task-explanation {
    margin-top: 5px;
    color: #666;
    font-style: italic;
    font-size: 12px;
}

/* Explanation Popup */
.explanation-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
}

.explanation-popup.active {
    display: block;
}

.explanation-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.explanation-popup-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 400px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.explanation-popup-header {
    padding: 20px;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.explanation-popup-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

.explanation-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.explanation-popup-close:hover {
    color: #dc3545;
    transform: scale(1.1);
}

.explanation-popup-body {
    padding: 20px;
    color: #495057;
    line-height: 1.6;
    font-size: 14px;
}

.task-step {
    padding: 4px 12px;
    font-weight: 600;
    font-size: 14px;
    display: inline-block;
}

.assigned-users {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.user-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
}

/* Result Fields */
.result-field {
    min-height: 40px;
    padding: 8px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.result-timestamp {
    font-size: 10px;
    color: #999;
    font-style: italic;
    margin-top: 2px;
    display: inline-block;
}

.result-by {
    font-size: 11px;
    color: #888;
    display: block;
    margin-top: 1px;
}

.result-field.approved {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
    font-style: normal;
}

.result-field.rejected {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
    font-style: normal;
}

.result-field.question {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
    font-style: normal;
}

.result-field.skipped {
    background: #e2e3e5;
    color: #383d41;
    border-color: #d6d8db;
    font-style: normal;
}

.result-field.answered {
    background: #d4edda;
    color: #155724;
}

/* Row Coloring */
.tasks-table tr.row-approved td[data-col="user"],
.tasks-table tr.row-approved td[data-col="result"],
.tasks-table tr.row-approved td[data-col="comment"],
.tasks-table tr.row-approved td[data-col="action"] {
    background-color: #d4edda !important;
}

.tasks-table tr.row-rejected td[data-col="user"],
.tasks-table tr.row-rejected td[data-col="result"],
.tasks-table tr.row-rejected td[data-col="comment"],
.tasks-table tr.row-rejected td[data-col="action"] {
    background-color: #f8d7da !important;
}

.tasks-table tr.row-question td[data-col="user"],
.tasks-table tr.row-question td[data-col="result"],
.tasks-table tr.row-question td[data-col="comment"],
.tasks-table tr.row-question td[data-col="action"] {
    background-color: #fff3cd !important;
}

.tasks-table tr.row-active td[data-col="user"],
.tasks-table tr.row-active td[data-col="result"],
.tasks-table tr.row-active td[data-col="comment"],
.tasks-table tr.row-active td[data-col="action"] {
    background-color: #f8f9fa !important;
}

.tasks-table tr.row-skipped td[data-col="user"],
.tasks-table tr.row-skipped td[data-col="result"],
.tasks-table tr.row-skipped td[data-col="comment"],
.tasks-table tr.row-skipped td[data-col="action"] {
    background-color: #e2e3e5 !important;
}

.tasks-table tr.row-completed td[data-col="user"],
.tasks-table tr.row-completed td[data-col="result"],
.tasks-table tr.row-completed td[data-col="comment"],
.tasks-table tr.row-completed td[data-col="action"] {
    background-color: #d4edda !important;
}

.tasks-table tr.row-answered td[data-col="user"],
.tasks-table tr.row-answered td[data-col="result"],
.tasks-table tr.row-answered td[data-col="comment"],
.tasks-table tr.row-answered td[data-col="action"] {
    background-color: #d4edda !important;
}

.tasks-table tr[data-task-index] td[data-col] {
    transition: background-color 0.3s ease;
}

/* Comment Fields */
.comment-field {
    min-height: 40px;
    padding: 8px;
    background: #f8f9fa;
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
}

.comment-field.editable {
    background: #fff;
    color: #333;
    font-style: normal;
    cursor: text;
    border-color: #007cba;
}

.comment-field.editable:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

.comment-field.has-comment {
    background: transparent;
    color: #6c757d;
    border-color: #e9ecef;
    font-style: normal;
}

.comment-field.disabled {
    cursor: not-allowed;
    opacity: 0.7;
    pointer-events: none;
}

.comment-field.fixed-text {
    background: transparent;
    color: #495057;
    border-color: #e9ecef;
    font-style: normal;
    cursor: default;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.action-btn.approve {
    background: #28a745;
    color: white;
}

.action-btn.approve:hover {
    background: #218838;
    transform: scale(1.1);
}

.action-btn.reject {
    background: #dc3545;
    color: white;
}

.action-btn.reject:hover {
    background: #c82333;
    transform: scale(1.1);
}

.action-btn.question {
    background: #ffc107;
    color: #212529;
}

.action-btn.question:hover {
    background: #e0a800;
    transform: scale(1.1);
}

.action-btn.answer {
    background: #17a2b8;
    color: white;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    min-width: 80px;
}

.action-btn.answer:hover {
    background: #138496;
    transform: scale(1.05);
}

.action-btn.skip {
    background: #007cba;
    color: white;
}

.action-btn.skip:hover {
    background: #005a87;
    transform: scale(1.1);
}

.action-btn.active {
    box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
    transform: scale(1.1);
}

.action-btn.disabled {
    background: #6c757d;
    color: #fff;
    cursor: not-allowed;
    opacity: 0.6;
}

.action-btn.disabled:hover {
    background: #6c757d;
    transform: none;
}

.action-btn.loading {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading States */
.tasks-table tbody.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Question Dialog */
.question-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.question-dialog-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.question-dialog-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 500px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

.question-dialog-header {
    padding: 20px 20px 0 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.question-dialog-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 18px;
}

.question-dialog-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-dialog-close:hover {
    color: #dc3545;
}

.question-dialog-body {
    padding: 20px;
}

.question-dialog-footer {
    padding: 0 20px 20px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.form-control:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.25);
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-primary {
    background: #007cba;
    color: white;
}

.btn-primary:hover {
    background: #005a87;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #6c757d;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s;
    margin-bottom: 20px;
}

.back-button:hover {
    background: #5a6268;
    color: white;
    text-decoration: none;
}

/* Files Section */
.files-section {
    margin-bottom: 30px;
}

.files-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.files-table thead {
    background: #f8f9fa;
}

.files-table th {
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
    color: #34495e;
    border-bottom: 2px solid #e8f4f8;
    font-size: 14px;
}

.files-table td {
    border-bottom: 1px solid #f1f3f4;
    vertical-align: middle;
}

.files-table tbody tr:hover {
    background: #f8f9fa;
}

.files-table tbody tr:last-child td {
    border-bottom: none;
}

.file-cell .file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-icon {
    font-size: 16px;
}

.file-name {
    font-weight: 500;
    color: #333;
    flex: 1;
}

.file-name-link {
    color: #dc3545;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.file-name-link:hover {
    color: #a02a37;
    text-decoration: underline;
}

.file-download {
    color: #3498db;
    text-decoration: none;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.file-download:hover {
    background: #e3f2fd;
    transform: scale(1.1);
}

.uploader-cell {
    font-weight: 500;
    color: #34495e;
}

.date-cell {
    color: #6c757d;
    font-size: 14px;
}

.visibility-cell {
    text-align: center;
}

.visibility-indicator {
    font-size: 18px;
    margin-right: 8px;
    vertical-align: middle;
}

.visibility-indicator.public {
    color: #28a745;
}

.visibility-indicator.private {
    color: #dc3545;
}

.visibility-text {
    font-size: 13px;
    font-weight: 500;
}

/* Action Cell */
.action-cell {
    text-align: center;
    width: 50px;
}

.delete-file-btn {
    background: white;
    color: #dc3545;
    border: none;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    width: 40px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.delete-file-btn:hover {
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.no-action {
    color: #ccc;
    font-size: 14px;
}

/* Restricted Files */
.file-restricted {
    opacity: 0.6;
}

.file-restricted-content {
    opacity: 0.5;
}

.file-name-restricted {
    display: inline-block;
    min-width: 150px;
}

.restricted-bar {
    display: inline-block;
    height: 12px;
    width: 150px;
    background: linear-gradient(90deg, #d0d0d0 0%, #e0e0e0 50%, #d0d0d0 100%);
    border-radius: 3px;
    vertical-align: middle;
}

.uploader-cell .restricted-bar,
.date-cell .restricted-bar {
    width: 80px;
    height: 10px;
}

/* File Upload Area - Red Theme */
.file-upload-area {
    border: 2px dashed #d3d3d3;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background: #ececec;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload-area:hover,
.file-upload-area.drag-over {
    border-color: #c82333;
    background: #ffe5e5;
    transform: scale(1.01);
}

.upload-content p {
    margin: 5px 0;
    color: #495057;
    font-size: 16px;
}

.upload-content a {
    color: #dc3545;
    text-decoration: none;
    font-weight: 600;
}

.upload-content a:hover {
    color: #c82333;
    text-decoration: underline;
}

.file-types {
    font-size: 12px;
    color: #6c757d;
}

.file-list {
    margin-top: 20px;
    text-align: left;
}

.file-list .file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.file-list .file-item:hover {
    border-color: #dc3545;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.1);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.file-size {
    color: #6c757d;
    font-size: 13px;
}

.file-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.file-visibility-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.file-visibility-btn:hover {
    border-color: #dc3545;
    background: #fff5f5;
}

.file-visibility-btn.public {
    background: #28a745;
    color: #fff;
    border-color: #28a745;
}

.file-visibility-btn.public:hover {
    background: #218838;
    border-color: #218838;
}

.file-remove-btn {
    padding: 6px 10px;
    border: 1px solid #dc3545;
    background: #fff;
    color: #dc3545;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.file-remove-btn:hover {
    background: #dc3545;
    color: #fff;
}

/* Primary Button - ROT - Höchste Priorität */
.sg-workflow-btn-primary,
button.sg-workflow-btn-primary,
.sg-workflow-btn.sg-workflow-btn-primary {
    background: linear-gradient(135deg, #dc3545, #c82333) !important;
    color: #fff !important;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4) !important;
}

.sg-workflow-btn-primary:hover,
button.sg-workflow-btn-primary:hover,
.sg-workflow-btn.sg-workflow-btn-primary:hover {
    background: linear-gradient(135deg, #c82333, #a71d2a) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.5) !important;
}

.sg-workflow-btn-primary:disabled {
    background: #e9a7a7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sg-workflow-btn-secondary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sg-workflow-btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.sg-workflow-btn-secondary:disabled {
    background: #a0c4e8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* Pagination Buttons (Vorherige/Nächste) - Blau wie Secondary */
.sg-workflow-btn:not(.sg-workflow-btn-primary):not(.sg-workflow-btn-secondary) {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sg-workflow-btn:not(.sg-workflow-btn-primary):not(.sg-workflow-btn-secondary):hover:not(:disabled) {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.sg-workflow-btn:not(.sg-workflow-btn-primary):not(.sg-workflow-btn-secondary):disabled {
    background: #a0c4e8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* Add Task Section */
.add-task-section {
    margin-bottom: 30px;
}

.add-task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e8f4f8;
}

.add-task-header h2 {
    margin: 0;
    color: #34495e;
    font-size: 1.5em;
    font-weight: 600;
}

.toggle-section-btn {
    background: #f8f9fa;
    border: 2px solid #e8f4f8;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    color: #34495e;
    display: flex;
    align-items: center;
    gap: 5px;
}

.toggle-section-btn:hover {
    background: #3498db;
    color: #ffffff;
    border-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.toggle-icon {
    transition: transform 0.3s ease;
    font-size: 12px;
}

.toggle-section-btn.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.add-tasks-content {
    animation: slideDown 0.3s ease-out;
}

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

.add-task-section .task-header {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 2px solid #e8f4f8;
    font-weight: 600;
    color: #34495e;
    font-size: 15px;
}

.add-task-section .task-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 20px;
    padding: 20px;
    border-bottom: 1px solid #f1f3f4;
    align-items: center;
    background: #ffffff;
    cursor: move;
    transition: all 0.3s ease;
}

.add-task-section .task-row:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.add-task-section .task-row:last-child {
    border-bottom: none;
}

.add-task-section .task-step-select,
.add-task-section .user-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e8f4f8;
    border-radius: 8px;
    font-size: 15px;
    color: #34495e;
    background: #ffffff;
    transition: all 0.3s ease;
    font-family: inherit;
}

.add-task-section .task-step-select:focus,
.add-task-section .user-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.add-task-section .task-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.add-task-section .task-explanation-btn,
.add-task-section .task-add-btn,
.add-task-section .task-remove-btn {
    position: relative;
    background: #f8f9fa;
    border: 2px solid #e8f4f8;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    color: #34495e;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tooltip sofort beim Hover (ohne Verzögerung) – Detail „Aufgaben hinzufügen“ */
.add-task-section .task-actions button[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    bottom: calc(100% + 8px);
    padding: 6px 10px;
    background: #2c3e50;
    color: #fff;
    font-size: 12px;
    font-weight: normal;
    white-space: nowrap;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.05s ease, visibility 0.05s ease;
    z-index: 10000;
}

.add-task-section .task-actions button[data-tooltip]::before {
    content: '';
    position: absolute;
    left: 50%;
    margin-left: -5px;
    bottom: calc(100% + 2px);
    border: 5px solid transparent;
    border-top-color: #2c3e50;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.05s ease, visibility 0.05s ease;
    z-index: 10001;
}

.add-task-section .task-actions button[data-tooltip]:hover::after,
.add-task-section .task-actions button[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

.add-task-section .task-add-btn {
    background: #27ae60;
    color: #ffffff;
    border-color: #27ae60;
}

.add-task-section .task-add-btn:hover {
    background: #229954;
    border-color: #229954;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

.add-task-section .task-remove-btn {
    background: #e74c3c;
    color: #ffffff;
    border-color: #e74c3c;
}

.add-task-section .task-remove-btn:hover {
    background: #c0392b;
    border-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.add-task-section .task-explanation-btn:hover {
    background: #3498db;
    color: #ffffff;
    border-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.add-task-section .task-explanation {
    grid-column: 1 / -1;
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e8f4f8;
}

.add-task-section .explanation-textarea {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    border: 2px solid #e8f4f8;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    color: #34495e;
    background: #ffffff;
    resize: vertical;
    transition: all 0.3s ease;
}

.add-task-section .explanation-textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Misc */
.timestamp {
    font-size: 11px;
    color: #6c757d;
    font-style: italic;
    margin-top: 4px;
}

.placeholder {
    color: #6c757d;
    font-style: italic;
}

.envelope-icon {
    margin-right: 5px;
}

.no-tasks {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    background: #f8f9fa;
    border-radius: 6px;
    border: 2px dashed #dee2e6;
}

.sg-workflow-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    text-align: center;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .sg-workflow-detail {
        padding: 15px;
    }

    .workflow-meta {
        flex-direction: column;
        gap: 10px;
    }

    .task-details {
        grid-template-columns: 1fr;
    }

    .task-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .tasks-table {
        font-size: 12px;
    }
    
    .tasks-table th,
    .tasks-table td {
        padding: 10px 8px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 4px;
    }
    
    .action-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}

/* ===== LOADING OVERLAY ===== */
.sg-workflow-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999 !important; /* Höher als Select2 (9999) */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sg-workflow-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sg-workflow-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #dc3545;
    border-radius: 50%;
    animation: sg-workflow-spin 1s linear infinite;
    background-color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.sg-workflow-loading-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin-top: 50px;
    color: #333;
    font-size: 16px;
    font-weight: 500;
    background-color: white;
    padding: 8px 16px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

@keyframes sg-workflow-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
