body {
    font-family: "Segoe UI", Arial, sans-serif;
    margin: 30px;
    background: #f6f8fa;
    color: #222;
}

.header {
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header h2 {
    margin: 0;
    font-size: 2.1em;
    letter-spacing: 0.01em;
}

.header form {
    margin-left: auto;
}

.header label {
    margin-right: 8px;
    font-weight: 500;
    color: #444;
}

select {
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid #c9c9c9;
    background: #fff;
    font-size: 1em;
}

.main {
    display: flex;
    gap: 3em;
    align-items: flex-start;
}

.table-area {
    min-width: 650px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 2px 12px #0001;
    padding: 18px 18px 7px 18px;
}

.table-area table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin-bottom: 8px;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 5px #0001;
    font-size: 1em;
}

th, td {
    padding: 5px 8px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f2f4f7;
    font-size: 1em;
    font-weight: 600;
    color: #333;
    border-top: 1px solid #eee;
}

tr:last-child td {
    border-bottom: none;
}

tr:nth-child(even) td {
    background: #f9fafc;
}

button {
    padding: 8px 22px;
    font-size: 1em;
    border-radius: 10px;
    background: #2b75d6;
    color: #fff;
    border: none;
    margin-top: 14px;
    box-shadow: 0 1px 5px #0001;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover {
    background: #195caa;
}

.text-area {
    flex: 1 1 0px;
    max-width: 315px;   /* <<< Hier ist die neue Breite */
    min-width: 220px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 2px 12px #0001;
    padding: 18px 14px 8px 14px;
    display: flex;
    flex-direction: column;
    border: 2.5px solid #b0c4de;
}

.text-area-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.text-area label {
    font-weight: 600;
    color: #444;
}

#copyBtn {
    background: #f0f4f8;
    color: #2565a6;
    border: 1.5px solid #a4bcd4;
    border-radius: 7px;
    padding: 4px 16px;
    font-size: 0.97em;
    font-weight: 500;
    cursor: pointer;
    margin-left: 18px;
    box-shadow: 0 1px 4px #0001;
    transition: background 0.13s, color 0.13s;
}
#copyBtn:hover {
    background: #e5eefa;
    color: #12396a;
}

#projekte_text {
    width: 100%;
    height: 40em;
    min-height: 420px;
    max-height: 700px;
    resize: vertical;
    font-family: "Fira Mono", "Consolas", monospace;
    font-size: 1.04em;
    padding: 10px;
    background: #f4f7fa;
    border: 2.5px solid #b0c4de;
    border-radius: 10px;
    box-shadow: 0 1px 4px #0001;
    margin-top: 0;
}

/* Header Controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.import-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.2s;
}

.import-btn:hover {
    background: #218838;
}

/* Overlay Styles */
.overlay {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.overlay-content {
    background: white;
    border-radius: 12px;
    padding: 0;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px 24px;
    border-bottom: 1px solid #eee;
}

.overlay-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.4em;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

/* Import Section */
.import-section {
    padding: 24px;
}

.import-section h4 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 1.2em;
}

.import-section p {
    margin: 0 0 20px 0;
    color: #666;
}

.file-inputs {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.file-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-input-group label {
    font-weight: 600;
    color: #444;
    font-size: 0.95em;
}

.file-input-group input[type="file"] {
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #f9f9f9;
    font-size: 0.9em;
}

.file-input-group input[type="file"]:hover {
    border-color: #b0c4de;
}

.file-hint {
    color: #6c757d;
    font-size: 0.85em;
    margin-top: 4px;
    font-style: italic;
}

.upload-info {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 20px;
}

.upload-info p {
    margin: 0;
    color: #0056b3;
    font-size: 0.95em;
}

.analyze-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background 0.2s;
}

.analyze-btn:hover {
    background: #0056b3;
}

/* Analysis Section */
.analysis-section {
    padding: 24px;
    border-top: 1px solid #eee;
}

.analysis-section h4 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 1.2em;
}

.file-analysis {
    margin-bottom: 20px;
}

.file-result {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.file-result h5 {
    margin: 0 0 8px 0;
    color: #495057;
    font-size: 1em;
}

.file-result ul {
    margin: 0;
    padding-left: 20px;
}

.file-result li {
    margin-bottom: 4px;
    color: #6c757d;
    font-size: 0.9em;
}

.import-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.import-start-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background 0.2s;
}

.import-start-btn:hover {
    background: #218838;
}

.cancel-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background 0.2s;
}

.cancel-btn:hover {
    background: #545b62;
}

/* Import Progress */
.import-progress {
    padding: 24px;
    text-align: center;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-top: 20px;
}

.import-progress h4 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 1.2em;
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #007bff, #28a745);
    animation: progress-animation 2s ease-in-out infinite;
    border-radius: 6px;
}

@keyframes progress-animation {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

#importStatus {
    margin: 0;
    color: #495057;
    font-size: 1em;
    font-weight: 500;
}

/* Button States */
.import-start-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
}

.import-start-btn:disabled:hover {
    background: #6c757d;
}

/* Import Page Styles */
.import-page {
    min-height: 100vh;
    background: #f6f8fa;
    padding: 20px;
}

.import-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.import-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.import-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.8em;
}

.close-link {
    color: #666;
    text-decoration: none;
    font-size: 1.1em;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.close-link:hover {
    background: #e9ecef;
    color: #333;
}

.import-content {
    padding: 32px;
}

.upload-section h3,
.analysis-section h3,
.import-results h3,
.error-section h3 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 1.4em;
}

.upload-section p {
    margin: 0 0 24px 0;
    color: #666;
    font-size: 1em;
}

.upload-form {
    margin-bottom: 24px;
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 24px;
}

.upload-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.2s;
}

.upload-btn:hover {
    background: #0056b3;
}

.cancel-link {
    color: #6c757d;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 6px;
    transition: background 0.2s;
}

.cancel-link:hover {
    background: #f8f9fa;
    color: #495057;
}

.import-form {
    margin-top: 24px;
}

.import-start-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.2s;
}

.import-start-btn:hover {
    background: #218838;
}

/* Allgemeine Meldungs-Styles */
.message {
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    font-size: 1em;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.message strong {
    display: block;
    margin-bottom: 4px;
}

.message.error-message {
    background: #fef2f2;
    border: 2px solid #f87171;
    color: #991b1b;
}

.message.warning-message {
    background: #fffbeb;
    border: 2px solid #fbbf24;
    color: #92400e;
}

.message.success-message {
    background: #f0fdf4;
    border: 2px solid #4ade80;
    color: #166534;
}

/* Legacy success-message für Import-Seite */
.success-message:not(.message) {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 24px;
}

.success-message:not(.message) p {
    margin: 0;
    color: #155724;
    font-weight: 500;
}

.import-summary {
    margin-bottom: 24px;
}

.file-summary {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.file-summary h4 {
    margin: 0 0 8px 0;
    color: #495057;
    font-size: 1.1em;
}

.file-summary ul {
    margin: 0;
    padding-left: 20px;
}

.file-summary li {
    margin-bottom: 4px;
    color: #6c757d;
    font-size: 0.95em;
}

.final-actions {
    text-align: center;
}

.back-btn {
    background: #007bff;
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 6px;
    display: inline-block;
    transition: background 0.2s;
}

.back-btn:hover {
    background: #0056b3;
}

.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 24px;
}

.error-message p {
    margin: 0;
    color: #721c24;
    font-weight: 500;
}

.error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.retry-link {
    background: #007bff;
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 6px;
    transition: background 0.2s;
}

.retry-link:hover {
    background: #0056b3;
}

.back-link {
    background: #6c757d;
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 6px;
    transition: background 0.2s;
}

.back-link:hover {
    background: #545b62;
}

/* Import History */
.import-history {
    margin-top: 20px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 2px 12px #0001;
    padding: 18px;
    border: 2.5px solid #e9ecef;
}

.import-history h3 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 1.2em;
    font-weight: 600;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: background 0.2s;
}

.history-item:hover {
    background: #e9ecef;
}

.file-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-name {
    font-weight: 600;
    color: #495057;
    font-size: 0.95em;
}

.import-date {
    color: #6c757d;
    font-size: 0.85em;
}

/* Login-Funktionalität */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    margin-bottom: 1.5rem;
    color: #333;
    text-align: center;
}

.login-form .form-group {
    margin-bottom: 1rem;
}

.login-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #555;
}

.token-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

.login-btn {
    width: 100%;
    padding: 0.75rem;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.login-btn:hover {
    background: #0056b3;
}

.login-info {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #666;
}

.logout-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #dc3545;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    margin-left: 1rem;
    transition: background-color 0.3s;
}

.logout-btn:hover {
    background: #c82333;
}

/* Export Summary Styles */
.export-summary {
    margin-top: 1rem;
    padding: 1rem;
    background: #e8f5e8;
    border-radius: 4px;
    border-left: 4px solid #28a745;
}

.export-summary h4 {
    margin-bottom: 0.75rem;
    color: #155724;
    font-size: 1rem;
}

.exported-tables {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}

.exported-table {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border-radius: 3px;
    border: 1px solid #d4edda;
}

.table-name {
    font-weight: 500;
    color: #333;
}

.export-status {
    color: #28a745;
    font-size: 0.9rem;
}

/* ZIP Download Section */
.zip-download-section {
    margin-top: 1rem;
    padding: 1rem;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    text-align: center;
}

.zip-download-section h5 {
    margin: 0 0 0.75rem 0;
    color: #856404;
    font-size: 1rem;
}

.zip-download-btn {
    display: inline-block;
    background: #ffc107;
    color: #212529;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
    transition: background 0.2s;
    border: 2px solid #ffc107;
}

.zip-download-btn:hover {
    background: #e0a800;
    border-color: #e0a800;
    color: #212529;
}

/* SharePoint Summary Styles */
.sharepoint-summary {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 4px;
    border-left: 4px solid #0078d4;
}

.sharepoint-success {
    background: #e8f4fd;
    border-color: #0078d4;
}

.sharepoint-error {
    background: #fde8e8;
    border-color: #d13438;
}

.sharepoint-summary h4 {
    margin-bottom: 0.75rem;
    color: #0078d4;
    font-size: 1rem;
}

.sharepoint-success p {
    color: #0078d4;
    margin: 0.25rem 0;
}

.sharepoint-error p {
    color: #d13438;
    margin: 0.25rem 0;
}

.download-link {
    background: #007bff;
    color: white;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    transition: background 0.2s;
    white-space: nowrap;
}

.download-link:hover {
    background: #0056b3;
}

@media (max-width: 1200px) {
    .main {
        flex-direction: column;
        gap: 2em;
    }
    .text-area {
        max-width: 100%;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .overlay-content {
        width: 95%;
        margin: 20px;
    }
    
    .import-actions {
        flex-direction: column;
    }
    
    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .download-link {
        align-self: flex-end;
    }
}
