/* --- Global Styles --- */
/* (Bestehende Stile ... unverändert) */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #f4f7fa;
    color: #333;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* --- Sidebar --- */
.sidebar {
    width: 240px;
    background-color: #2c3e50;
    color: #ecf0f1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #34495e;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.version-container {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 5px;
}
.version-container a {
    color: #ecf0f1;
    text-decoration: none;
}
.version-container a:hover {
    text-decoration: underline;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.sidebar li button.tab-link {
    display: block;
    width: 100%;
    padding: 15px 20px;
    background: none;
    border: none;
    color: #ecf0f1;
    text-align: left;
    font-size: 1rem;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.sidebar li button.tab-link:hover {
    background-color: #34495e;
}

.sidebar li button.tab-link.active {
    background-color: #46627f;
    border-left: 3px solid #3498db;
    font-weight: bold;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #34495e;
}

.sidebar-footer a {
    color: #ecf0f1;
    text-decoration: none;
    display: block;
    text-align: center;
    background-color: #e74c3c;
    padding: 10px;
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

.sidebar-footer a:hover {
    background-color: #c0392b;
}


/* --- Main Content --- */
.main-content {
    flex-grow: 1;
    padding: 25px;
    overflow-y: auto;
    height: 100vh;
    box-sizing: border-box;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

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

h2 {
    color: #2c3e50;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

/* --- Header Grid --- */
.header-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.header-item {
    background-color: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    font-size: 0.9rem;
}
#last-updated {
    text-align: right;
    color: #7f8c8d;
}
.status-online {
    color: #27ae60;
    font-weight: bold;
}
.status-offline {
    color: #e74c3c;
    font-weight: bold;
}


/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-bottom: 4px solid #3498db;
}

.live-stats .stat-card {
    border-bottom-color: #f39c12;
}
.live-stats .stat-card p {
    font-size: 2.5rem;
}

.stat-card h3 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: #555;
    text-transform: uppercase;
}

.stat-card p {
    margin: 0;
    font-size: 2.2rem;
    font-weight: 600;
    color: #2c3e50;
}

/* --- Card System --- */
.card {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.full-width-card {
    grid-column: 1 / -1;
}

.card h3 {
    margin-top: 0;
    color: #2c3e50;
}

/* --- Chart Container --- */
.chart-container {
    position: relative;
    height: 300px;
}

/* --- Table Styles --- */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

table th, table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

table th {
    background-color: #f9f9f9;
    font-weight: 600;
    color: #555;
}

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

table tr:hover {
    background-color: #f5f5f5;
}

/* Status-spezifische Stile */
.status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    color: #fff;
}
.status-completed, .status-badge.completed { background-color: #27ae60; }
.status-failed, .status-badge.failed { background-color: #e74c3c; }
.status-rejected, .status-badge.rejected { background-color: #f39c12; }
.status-processing { background-color: #3498db; }
.status-submitted { background-color: #9b59b6; }
.status-pending { background-color: #9b59b6; } /* Alias für submitted */

/* --- Listen-Stile (z.B. Rejection Reasons) --- */
ul {
    padding-left: 20px;
}
ul li {
    margin-bottom: 8px;
}

/* --- Analyse-Tab (Accordion) --- */
.analysis-controls {
    margin-bottom: 15px;
}
.analysis-controls button {
    background-color: #3498db;
    color: white;
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}
.analysis-controls button:hover {
    background-color: #2980b9;
}

.accordion-container {
    max-width: 800px;
}
.accordion-item {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.accordion-header {
    background-color: #f9f9f9;
    padding: 15px 20px;
    width: 100%;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.accordion-header:hover {
    background-color: #f1f1f1;
}
.analysis-date {
    font-weight: bold;
    font-size: 1.1rem;
    color: #2c3e50;
}
.analysis-summary {
    display: flex;
    gap: 15px;
}
.accordion-content {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}
.accordion-content h4 {
    margin-top: 15px;
}
.accordion-content p {
    margin-top: 0;
}


/* --- Einstellungs-Tab --- */
.settings-form {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}
.settings-form input[type="text"],
.settings-form input[type="email"],
.settings-form input[type="password"] {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}
.settings-form button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.settings-form button:hover {
    background-color: #2980b9;
}
.delete-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
}
.delete-btn:hover {
    background-color: #c0392b;
}
.api-key-code {
    font-family: monospace;
    background-color: #f0f0f0;
    padding: 2px 5px;
    border-radius: 3px;
}


/* --- Hilfsklassen --- */
.error-text {
    color: #e74c3c;
    font-weight: bold;
}


/* --- Auftragsdetails (Suche) --- */
.search-form {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}
.search-form input[type="text"] {
    flex-grow: 1;
    padding: 12px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 5px;
}
.search-form button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
}
.search-form button:hover {
    background-color: #2980b9;
}

.details-container {
    margin-top: 20px;
}

/* Zusammenfassung (Details) */
.order-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-bottom: 20px;
}
.order-summary-item {
    background-color: #fff;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.order-summary-item h4 {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    color: #555;
    text-transform: uppercase;
}
.order-summary-item p {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    word-break: break-all;
}

/* Container-Details (Details) */
.container-info-section {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.container-info-section h4 {
    margin: 0;
    padding: 15px 20px;
    background-color: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
}
.container-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    padding: 15px 20px;
}
.container-stat-item {
    padding: 10px;
    background-color: #fdfdfd;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
}
.container-stat-item h5 {
    margin: 0 0 5px 0;
    font-size: 0.8rem;
    color: #777;
}
.container-stat-item p {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
}
.container-article-list {
    padding: 0 20px 20px 20px;
}
.container-article-list h5 {
    margin-top: 10px;
    margin-bottom: 10px;
}

/* --- NEU: Auftrags-Explorer --- */

/* Filter-Formular */
#explorer-filter-form fieldset {
    border: none;
    padding: 0;
    margin: 0;
}
#explorer-filter-form legend {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #2c3e50;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}
.filter-group label {
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.9rem;
}
.filter-group input[type="text"],
.filter-group input[type="number"],
.filter-group input[type="date"] {
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.9rem;
}

.filter-group .input-range {
    display: flex;
    align-items: center;
    gap: 8px;
}
.filter-group .input-range input {
    width: 100%;
}
.filter-group .input-range span {
    color: #777;
    font-size: 0.9rem;
}

/* Spezielles Layout für Datumsbereich */
@media (min-width: 800px) {
    .filter-group-span-2 {
        grid-column: span 2;
    }
}


/* Status Checkboxen */
.status-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.status-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
    font-size: 0.85rem;
    margin-bottom: 0;
}
.status-checkbox-group input[type="checkbox"] {
    margin: 0;
}

/* Filter-Aktionen */
.filter-actions {
    display: flex;
    align-items: flex-end; /* Richtet Buttons am Boden aus */
    gap: 10px;
}
.filter-actions button {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}
.filter-actions .button-primary {
    background-color: #3498db;
    color: white;
}
.filter-actions .button-primary:hover {
    background-color: #2980b9;
}
.filter-actions button[type="reset"] {
    background-color: #e0e0e0;
    color: #333;
}
.filter-actions button[type="reset"]:hover {
    background-color: #c7c7c7;
}


/* Explorer Ergebnis-Header */
.explorer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.explorer-header h3 {
    margin: 0;
}
#explorer-summary {
    font-size: 0.9rem;
    color: #555;
}

/* Explorer Ergebnistabelle */
#explorer-results-container {
    width: 100%;
    overflow-x: auto; /* Stellt sicher, dass Tabellen auf kleinen Schirmen scrollbar sind */
}
#explorer-results-container table th.sortable {
    cursor: pointer;
    user-select: none;
}
#explorer-results-container table th.sortable:hover {
    background-color: #f0f0f0;
}
/* Sortier-Indikatoren */
#explorer-results-container table th .sort-icon {
    font-size: 0.7rem;
    margin-left: 5px;
    color: #999;
    display: inline-block;
}
#explorer-results-container table th.sorted-asc .sort-icon,
#explorer-results-container table th.sorted-desc .sort-icon {
    color: #2c3e50;
}

/* Paginierung */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}
.pagination-controls button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 5px;
    cursor: pointer;
}
.pagination-controls button:hover {
    background-color: #2980b9;
}
.pagination-controls button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}
#explorer-page-info {
    font-size: 0.9rem;
    font-weight: 500;
}