/* MeinArztbedarf Blog Automation Dashboard */

:root {
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --primary-light: #dbeafe;
    --success: #22c55e;
    --success-bg: #f0fdf4;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-container h1 {
    color: var(--primary);
    margin-bottom: 4px;
    font-size: 24px;
}

.login-container .subtitle {
    color: var(--gray-500);
    margin-bottom: 24px;
    font-size: 14px;
}

/* Layout */
.header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 18px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

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

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.stat-card .label {
    font-size: 13px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-card .value.warning { color: var(--warning); }
.stat-card .value.danger { color: var(--danger); }
.stat-card .value.success { color: var(--success); }

/* Panels */
.panel {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.panel-body { padding: 20px; }
.panel-body.no-padding { padding: 0; }

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 24px;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 500;
    color: var(--gray-500);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-size: 14px;
}

.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

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

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
}

th {
    font-weight: 600;
    color: var(--gray-600);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--gray-50);
}

tr:hover { background: var(--gray-50); }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-pending { background: var(--primary-light); color: var(--primary); }
.badge-completed { background: var(--success-bg); color: #166534; }
.badge-success { background: var(--success-bg); color: #166534; }
.badge-error { background: var(--danger-bg); color: #991b1b; }
.badge-warning { background: var(--warning-bg); color: #92400e; }
.badge-start { background: var(--primary-light); color: var(--primary); }
.badge-info { background: var(--gray-100); color: var(--gray-600); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: white; border-color: var(--gray-300); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--gray-400);
    border-radius: 4px;
}

.btn-icon:hover { color: var(--gray-700); background: var(--gray-100); }

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 4px;
}

input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

textarea { resize: vertical; min-height: 80px; }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success { background: var(--success-bg); color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-bg); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #93c5fd; }

/* Topic list */
.topic-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--gray-100);
}

.topic-row:last-child { border-bottom: none; }

.topic-row .topic-num {
    color: var(--gray-400);
    font-size: 13px;
    min-width: 30px;
}

.topic-row .topic-title {
    flex: 1;
    font-size: 14px;
}

.topic-row .topic-category {
    font-size: 12px;
    color: var(--gray-500);
}

.topic-row .topic-actions {
    display: flex;
    gap: 4px;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.modal h3 { margin-bottom: 16px; }

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

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

.generating-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    color: white;
}

.generating-overlay .spinner-large {
    width: 48px;
    height: 48px;
    border-width: 4px;
    margin-bottom: 16px;
}

/* Log */
.log-entry {
    padding: 8px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
}

.log-entry .log-time {
    color: var(--gray-400);
    font-size: 12px;
    margin-right: 8px;
}

.log-entry .log-topic {
    font-weight: 500;
}

/* Dropbox status */
.dropbox-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

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

.status-dot.connected { background: var(--success); }
.status-dot.disconnected { background: var(--danger); }

/* Drag & Drop */
.drag-handle {
    cursor: grab;
    color: var(--gray-300);
    font-size: 16px;
    user-select: none;
    text-align: center;
    width: 30px;
    padding-left: 8px !important;
    padding-right: 4px !important;
}

.drag-handle:hover { color: var(--gray-500); }
.drag-handle:active { cursor: grabbing; }

tr[draggable] { transition: background 0.15s; }
tr.dragging { opacity: 0.4; background: var(--primary-light); }
tr.drag-over { border-top: 2px solid var(--primary); }

/* Suggest Topics */
.suggest-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
}

.suggest-item {
    border-bottom: 1px solid var(--gray-100);
}

.suggest-item:last-child { border-bottom: none; }

.suggest-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.suggest-label:hover { background: var(--gray-50); }

.suggest-label input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
    width: auto;
}

.suggest-content { flex: 1; min-width: 0; }

.suggest-title {
    font-size: 14px;
    color: var(--gray-800);
    line-height: 1.4;
}

.suggest-category {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 16px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .header { padding: 12px 16px; }
    .header h1 { font-size: 16px; }
    th, td { padding: 8px 12px; }
    .tabs { overflow-x: auto; }
}

@media (max-width: 480px) {
    .stats { grid-template-columns: 1fr; }
}
