/**
 * Timeler Admin — Konsolidiertes Stylesheet
 *
 * Vereint alle Inline-Styles aus index.php, tenants.php,
 * editor-licenses.php und oneflow-tenants.php.
 */

/* ============================================
   1. CSS Variables
   ============================================ */

:root {
    --color-primary: #3b82f6;
    --color-primary-dark: #2563eb;
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-gray-50: #f8f9fa;
    --color-gray-100: #f1f5f9;
    --color-gray-200: #e2e8f0;
    --color-gray-300: #cbd5e1;
    --color-gray-500: #64748b;
    --color-gray-600: #475569;
    --color-gray-700: #334155;
    --color-gray-800: #1e293b;
    --color-gray-900: #0f172a;
    --radius: 8px;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}

/* ============================================
   2. Reset & Base
   ============================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================
   3. Header & Navigation
   ============================================ */

.header {
    background: #1a1a2e;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 { font-size: 1.5rem; display: flex; align-items: center; gap: 0.5rem; }
.header-logo { flex-shrink: 0; }

.header nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header nav a {
    color: #aaa;
    text-decoration: none;
    font-size: 0.9rem;
}

.header nav a:hover { color: white; text-decoration: none; }
.header nav a.active { color: #4CAF50; font-weight: 600; }

.header .tenant-select {
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    border: 1px solid #444;
    background: #2a2a4e;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
}

.header .tenant-select:hover { border-color: #666; }
.header .tenant-select option { background: #1a1a2e; }

/* ============================================
   4. Container
   ============================================ */

.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* ============================================
   5. Cards
   ============================================ */

.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 { font-size: 1.2rem; color: #333; }

.card-body { padding: 1.5rem; }

.card h2 { margin-top: 0; color: var(--color-gray-800); font-size: 1.3rem; }

/* ============================================
   6. Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-dark); }

.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover { background: #5a6268; }

.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover { background: #c82333; }

.btn-success { background: var(--color-success); color: white; }
.btn-success:hover { background: #16a34a; }

.btn-warning { background: var(--color-warning); color: white; }
.btn-warning:hover { background: #d97706; }

.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }

/* Spezielle Button-Varianten (index.php Quick Actions) */
.btn-purple { background: #8B5CF6; color: white; }
.btn-purple:hover { background: #7C3AED; }

.btn-gray { background: #6B7280; color: white; }
.btn-gray:hover { background: #4B5563; }

/* ============================================
   7. Tables
   ============================================ */

table { width: 100%; border-collapse: collapse; }

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: var(--color-gray-50);
    font-weight: 600;
    color: var(--color-gray-600);
    font-size: 0.85rem;
}

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

/* Tabelle in Card (gerundete Ecken) */
.card table { margin: 0; }
.card table th:first-child { border-top-left-radius: var(--radius); }
.card table th:last-child { border-top-right-radius: var(--radius); }

/* ============================================
   8. Badges
   ============================================ */

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-secondary { background: #e2e3e5; color: #383d41; }

/* Pill-Style Badges (index.php Tenant-Status) */
.badge-pill {
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
}

.badge-pill.badge-success { background: #D1FAE5; color: #065F46; }
.badge-pill.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-pill.badge-danger { background: #FEE2E2; color: #991B1B; }

/* ============================================
   9. Forms
   ============================================ */

.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group small { color: #666; font-size: 0.85rem; }

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* ============================================
   10. Alerts
   ============================================ */

.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* Alert-Box (index.php DSGVO-Warnungen) */
.alert-box {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 20px;
}

.alert-box h4 { margin: 0 0 10px 0; color: #991B1B; }
.alert-box ul { margin: 0; padding-left: 20px; }

/* ============================================
   11. Stats
   ============================================ */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-card .number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--color-primary);
}

.stat-card .label {
    color: #666;
    font-size: 0.9rem;
}

/* Stats Mini (tenants.php Detail) */
.stats-mini {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.stat-mini {
    background: var(--color-gray-50);
    padding: 10px;
    border-radius: var(--radius);
    text-align: center;
}

.stat-mini strong {
    display: block;
    font-size: 1.5rem;
    color: var(--color-primary);
}

.stat-mini span { font-size: 0.8rem; color: #6B7280; }

/* ============================================
   12. Feature Tags & Checkboxes
   ============================================ */

.feature-tag {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.7rem;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 3px;
    margin: 1px 2px;
}

.feature-checkboxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.feature-checkboxes label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

/* ============================================
   13. Modals
   ============================================ */

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

.modal {
    background: white;
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal h3 { margin: 0 0 20px; font-size: 1.2rem; }

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

/* ============================================
   14. Detail Grid
   ============================================ */

.detail-section { margin-bottom: 20px; }

.detail-section h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
}

.detail-grid {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 6px 12px;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.detail-grid dt { color: #666; font-weight: 500; }
.detail-grid dd { color: #333; }

/* Detail-Items (tenants.php Variante mit label/span) */
.detail-item label {
    display: block;
    font-size: 0.8rem;
    color: #6B7280;
    margin-bottom: 3px;
}

.detail-item span { font-weight: 500; color: #1F2937; }

/* Zwei-Spalten Detail-Grid (tenants.php) */
.detail-grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

/* ============================================
   15. Domain List
   ============================================ */

.domain-list { list-style: none; padding: 0; }

.domain-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.domain-add-row { display: flex; gap: 8px; margin-top: 8px; }
.domain-add-row input { flex: 1; }

/* ============================================
   16. Spezifische Komponenten
   ============================================ */

/* License Key (editor-licenses.php) */
.license-key {
    font-family: monospace;
    background: var(--color-gray-50);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Audit List (tenants.php) */
.audit-list { font-size: 0.85rem; list-style: none; padding: 0; margin: 0; }
.audit-list li { padding: 8px 0; border-bottom: 1px solid #E5E7EB; }
.audit-list .time { color: #6B7280; }
.audit-list .action { font-weight: 500; }

/* Section Title (index.php) */
.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 30px 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #E5E7EB;
}

/* Actions Row */
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Info Box (tenants.php Admin-Zugang) */
.info-box {
    background: var(--color-gray-50);
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

/* ============================================
   17. Toast
   ============================================ */

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 20000;
    animation: toastIn 0.3s ease;
    box-shadow: var(--shadow-lg);
    color: white;
}

.toast-success { background: #166534; }
.toast-error { background: #dc2626; }

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

/* ============================================
   18. Login
   ============================================ */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #1a1a2e;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 10px;
    color: var(--color-gray-800);
    font-size: 1.5rem;
}

.login-box .subtitle {
    text-align: center;
    color: #6B7280;
    margin-bottom: 20px;
}

/* ============================================
   19. Responsive
   ============================================ */

@media (max-width: 768px) {
    .header { flex-direction: column; gap: 1rem; padding: 1rem; }
    .header nav { flex-wrap: wrap; gap: 0.75rem; }
    .container { padding: 0 1rem; margin: 1rem auto; }
    .form-row { grid-template-columns: 1fr; }
    .feature-checkboxes { grid-template-columns: 1fr; }
    .stats-mini { grid-template-columns: repeat(2, 1fr); }
    .detail-grid-2col { grid-template-columns: 1fr; }
    table { font-size: 0.85rem; }
    th, td { padding: 0.5rem; }
    .modal { margin: 10px; max-width: none; }
}
