/* Dashboard Core Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #2c3e50;
    line-height: 1.6;
    transition: all 0.3s ease;
    padding-bottom: 60px;
}

body.dark {
    background: #1a1a1a;
    color: #e9ecef;
}

/* Preload für Dark Mode um Flackern zu vermeiden */
.dark-mode-preload {
    background-color: #1a1a1a;
}

html.dark-mode-preload body {
    background-color: #1a1a1a;
    color: #e9ecef;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid #e9ecef;
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.dark .header {
    background: #2d2d2d;
    border-bottom-color: #404040;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
}

body.dark .header h1 {
    color: #e9ecef;
}

.header-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

/* Links */
a {
    color: #0056b3;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

body.dark a {
    color: #5dade2;
}

body.dark a:hover {
    color: #7fb3d5;
}

body.dark .btn {
    background: #404040;
    border-color: #555;
    color: #e9ecef;
}

.btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

body.dark .btn:hover {
    background: #555;
    border-color: #777;
}

/* Main Content */
.main-content {
    width: 100%;
    margin: 32px auto;
    padding: 0 32px;
}

/* Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    width: 100%;
}

/* Module Cards */
.module-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 24px;
    transition: box-shadow 0.2s;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

body.dark .module-card {
    background: #2d2d2d;
    border-color: #404040;
}

.module-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.dark .module-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.module-card img {
    width: 120px;
    max-height: 80px;
    object-fit: contain;
    margin-bottom: 16px;
}

.module-title {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 20px;
}

body.dark .module-title {
    color: #e9ecef;
}

.module-action {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.module-action:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

body.dark .module-action {
    background: #404040;
    color: #e9ecef;
    border-color: #555;
}

body.dark .module-action:hover {
    background: #555;
    border-color: #777;
}

/* Content Blocks */
.container {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 32px;
    width: 100%;
}

.block {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

body.dark .block {
    background: #2d2d2d;
    border-color: #404040;
}

.block h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #2c3e50;
}

body.dark .block h2 {
    color: #e9ecef;
}

/* Form Elements */
input, button, select, textarea {
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    transition: all 0.2s;
}

input, select, textarea {
    background: white;
    color: #495057;
    width: 100%;
    margin-bottom: 12px;
}

body.dark input, 
body.dark select, 
body.dark textarea {
    background: #404040;
    color: #e9ecef;
    border-color: #555;
}

input:focus, 
select:focus, 
textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

body.dark table {
    background: #2d2d2d;
    border-color: #404040;
}

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

body.dark th, body.dark td {
    border-bottom-color: #404040;
}

th {
    background: #e9ecef;
    font-weight: 600;
    color: #343a40;
}

body.dark th {
    background: #404040;
    color: #e9ecef;
}

tr:hover {
    background-color: #f2f4f6;
}

body.dark tr:hover {
    background-color: #404040;
}

/* Status Bar */
.status-bar {
    background: white;
    border-top: 1px solid #e9ecef;
    padding: 10px 32px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 13px;
    color: #6c757d;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.dark .status-bar {
    background: #2d2d2d;
    border-top-color: #404040;
    color: #adb5bd;
}

.status-left {
    display: flex;
    gap: 20px;
    align-items: center;
}

.status-right {
    display: flex;
    gap: 20px;
    align-items: center;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
}

/* Utility Classes */
.search-container {
    margin-bottom: 20px;
}

.search-container input {
    max-width: 300px;
}

.loading {
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 10px;
}

.loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #6c757d;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

body.dark .loading {
    color: #adb5bd;
}

body.dark .loading::before {
    border-color: #adb5bd;
    border-top-color: transparent;
}

.status {
    padding: 12px 16px;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    margin-bottom: 24px;
}

body.dark .status {
    background: #1e3a1e;
    color: #b5e0b5;
    border-color: #2d5a2d;
}

/* Action Buttons */
.action-btn {
    padding: 10px 16px;
    font-size: 14px;
    margin: 8px 8px 8px 0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

/* System Log */
#log {
    background: #1a1a1a;
    color: #00ff00;
    padding: 16px;
    margin-top: 16px;
    height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    border-radius: 6px;
    border: 1px solid #404040;
}

.green { background: #28a745; color: white; }
.green:hover { background: #218838; }
.blue { background: #007bff; color: white; }
.blue:hover { background: #0056b3; }
.red { background: #dc3545; color: white; }
.red:hover { background: #c82333; }
.gray { background: #6c757d; color: white; }
.gray:hover { background: #545b62; }

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 16px 20px;
        flex-direction: column;
        gap: 16px;
    }

    .main-content {
        margin: 20px auto;
        padding: 0 20px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .container {
        flex-direction: column;
    }

    .status-bar {
        padding: 12px 20px;
        flex-direction: column;
        gap: 8px;
    }

    .status-left {
        flex-direction: column;
        gap: 8px;
    }

    .status-right {
        align-self: flex-end;
    }
}