/* Modern Design System - Blueprint - White Theme */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f1f5f9;
    min-height: 100vh;
    padding: 24px;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

/* Header Styles */
header {
    background: white;
    color: var(--text-primary);
    padding: 32px 40px;
    border-bottom: 1px solid var(--border-light);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.table-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.nav-link {
    padding: 12px 24px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    font-weight: 500;
    border: 1px solid var(--border-light);
}

.nav-link:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.nav-link.active {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.workflow-link {
    padding: 12px 28px;
    background: white;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    font-weight: 600;
    margin-left: 20px;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--primary-color);
}

.workflow-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Main Content */
main {
    padding: 40px;
    background: var(--bg-secondary);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 24px;
    padding: 24px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.toolbar h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin: 0;
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-edit:hover {
    background: #dbeafe;
    transform: scale(1.1);
}

.btn-delete:hover {
    background: #fee2e2;
    transform: scale(1.1);
}

/* Table Container */
.table-container {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.loading {
    text-align: center;
    padding: 60px 20px;
    font-size: 1.2rem;
    color: var(--primary-color);
    font-weight: 500;
}

.error-message {
    background: #fee2e2;
    color: #991b1b;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    border-left: 4px solid var(--error-color);
    font-weight: 500;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table thead {
    background: #f8fafc;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-light);
}

.data-table th {
    padding: 18px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: var(--primary-light);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-light);
}

@keyframes slideUp {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 28px 32px;
    border-bottom: 1px solid var(--border-light);
    background: white;
    color: var(--text-primary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-header h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.close-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 1.75rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    font-weight: 300;
}

.close-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
}

.modal-form {
    padding: 32px;
    background: white;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

.form-control:disabled {
    background: var(--bg-tertiary);
    cursor: not-allowed;
    opacity: 0.7;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.info-box {
    padding: 16px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    min-width: 320px;
    max-width: 520px;
    padding: 18px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 14px;
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    background: white;
    border: 1px solid var(--border-light);
}

@keyframes slideInRight {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    background: white;
    color: var(--success-color);
    border-left: 4px solid var(--success-color);
}

.toast-error {
    background: white;
    color: var(--error-color);
    border-left: 4px solid var(--error-color);
}

.toast-info {
    background: white;
    color: var(--info-color);
    border-left: 4px solid var(--info-color);
}

.toast-warning {
    background: white;
    color: var(--warning-color);
    border-left: 4px solid var(--warning-color);
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    color: var(--text-primary);
}

.toast-close {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--bg-tertiary);
}

/* Struktur-Baum - Modernes Design */
.structure-tree-container {
    padding: 32px;
}

.tree-controls {
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.tree-controls label {
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.tree-controls label::before {
    content: '📦';
    font-size: 1.5rem;
}

.product-select {
    padding: 14px 24px;
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-size: 1rem;
    min-width: 360px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.product-select:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.product-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.structure-tree {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    min-height: 300px;
}

.tree-node {
    margin: 10px 0;
}

.tree-node-content {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    border: 2px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.tree-node-content::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.tree-node-content:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    transform: translateX(6px);
    box-shadow: var(--shadow-md);
}

.tree-node-content:hover::before {
    transform: scaleY(1);
}

.tree-node-content.has-children {
    font-weight: 600;
    font-size: 1.05rem;
}

.tree-node-content.expanded {
    background: var(--primary-light);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.tree-node-content.expanded::before {
    transform: scaleY(1);
}

.tree-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    text-align: center;
    font-size: 0.875rem;
    color: var(--primary-color);
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    font-weight: bold;
}

.tree-toggle:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.15);
}

.tree-spacer {
    display: inline-block;
    width: 32px;
}

.tree-label {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tree-add-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    opacity: 0;
    margin-left: auto;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.tree-node-content:hover .tree-add-btn {
    opacity: 1;
}

.tree-add-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.tree-node-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.tree-edit-btn,
.tree-delete-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.tree-node-content:hover .tree-edit-btn,
.tree-node-content:hover .tree-delete-btn {
    opacity: 1;
}

.tree-edit-btn {
    background: var(--success-color);
    color: white;
}

.tree-edit-btn:hover {
    background: #059669;
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.tree-delete-btn {
    background: var(--error-color);
    color: white;
}

.tree-delete-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.tree-label::before {
    content: '📦';
    font-size: 1.2rem;
}

.tree-node-content.expanded .tree-label::before {
    content: '📂';
}

.tree-children {
    margin-left: 24px;
    border-left: 2px solid var(--border-light);
    padding-left: 24px;
    margin-top: 10px;
    position: relative;
}

.tree-children::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-light);
}

.tree-loading,
.tree-empty,
.tree-error {
    text-align: center;
    padding: 60px 20px;
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.tree-loading {
    color: var(--primary-color);
    font-weight: 600;
}

.tree-empty {
    color: var(--text-tertiary);
    font-style: italic;
}

.tree-error {
    color: var(--error-color);
    font-weight: 600;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 6px;
    border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }
    
    header {
        padding: 24px;
    }
    
    header h1 {
        font-size: 1.875rem;
        margin-bottom: 20px;
    }
    
    .table-nav {
        flex-direction: column;
    }
    
    .nav-link {
        text-align: center;
        width: 100%;
    }
    
    .workflow-link {
        margin-left: 0;
        margin-top: 12px;
        width: 100%;
        text-align: center;
    }
    
    main {
        padding: 24px;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
    }
    
    .toolbar h2 {
        font-size: 1.5rem;
    }
    
    .data-table {
        font-size: 0.875rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 12px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .structure-tree-container {
        padding: 20px;
    }
    
    .tree-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .product-select {
        min-width: 100%;
    }
    
    .table-container {
        overflow-x: auto;
    }
}
