/* z-komm Cockpit */

:root {
    --color-primary: #3b82f6;
    --color-primary-dark: #2563eb;
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-gray-50: #f8fafc;
    --color-gray-100: #f1f5f9;
    --color-gray-200: #e2e8f0;
    --color-gray-300: #cbd5e1;
    --color-gray-400: #94a3b8;
    --color-gray-500: #64748b;
    --color-gray-600: #475569;
    --color-gray-700: #334155;
    --color-gray-800: #1e293b;
    --color-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-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);

    --status-green: #22c55e;
    --status-yellow: #f59e0b;
    --status-red: #ef4444;
}

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

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

/* ============================================
   Login
   ============================================ */

.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
}

.login-box h1 {
    font-size: 22px;
    margin-bottom: 24px;
    color: var(--color-gray-900);
}

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

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-gray-200);
    border-radius: 4px;
    font-size: 14px;
}

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

.error {
    color: var(--color-danger);
    font-size: 13px;
    margin-bottom: 12px;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}

.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: white; color: var(--color-gray-600); border: 1px solid var(--color-gray-200); }
.btn-secondary:hover { background: var(--color-gray-50); color: var(--color-gray-800); }

.btn-success { background: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }
.btn-success:hover { background: #ecfdf5; }

.btn-danger { background: white; color: var(--color-danger); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fef2f2; }

.btn-warning { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.btn-warning:hover { background: #fef9c3; }

.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ============================================
   Navigation
   ============================================ */

.cockpit-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--color-gray-900);
    color: white;
}

.cockpit-logo {
    font-weight: 700;
    font-size: 16px;
    color: white;
    text-decoration: none;
}

.cockpit-nav-links {
    display: flex;
    gap: 4px;
}

.cockpit-nav-links a {
    color: var(--color-gray-400);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.cockpit-nav-links a:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.cockpit-nav-links a.active {
    color: white;
    background: rgba(255,255,255,0.15);
}

.cockpit-nav-links .nav-logout {
    margin-left: 12px;
    color: var(--color-gray-500);
}

/* ============================================
   Layout
   ============================================ */

.cockpit-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#app-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    width: 100%;
}

/* ============================================
   Stats Bar (Ampel-Übersicht)
   ============================================ */

.cockpit-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.cockpit-stat {
    background: white;
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.cockpit-stat-label {
    font-size: 12px;
    color: var(--color-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cockpit-stat--green .cockpit-stat-value { color: var(--status-green); }
.cockpit-stat--yellow .cockpit-stat-value { color: var(--status-yellow); }
.cockpit-stat--red .cockpit-stat-value { color: var(--status-red); }

/* ============================================
   Status Dots (Ampel)
   ============================================ */

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 2px;
}

.status-dot--green { background: var(--status-green); }
.status-dot--yellow { background: var(--status-yellow); }
.status-dot--red { background: var(--status-red); }
.status-dot--none { background: var(--color-gray-300); }

/* ============================================
   Toolbar
   ============================================ */

.cockpit-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.cockpit-toolbar h3 {
    font-size: 16px;
}

/* ============================================
   Card & Table
   ============================================ */

.cockpit-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.cockpit-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-gray-100);
    font-weight: 600;
    font-size: 15px;
}

.cockpit-card-body {
    padding: 20px;
}

.cockpit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.cockpit-table th {
    text-align: left;
    padding: 10px 14px;
    background: var(--color-gray-50);
    border-bottom: 2px solid var(--color-gray-200);
    font-weight: 600;
    color: var(--color-gray-600);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cockpit-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-gray-100);
    vertical-align: middle;
}

.cockpit-table tr:hover td {
    background: var(--color-gray-50);
}

.cockpit-table tr[data-href] { cursor: pointer; }

.cockpit-table .ampel-cell {
    white-space: nowrap;
}

/* ============================================
   Status Badge
   ============================================ */

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge--green { background: #d1fae5; color: #047857; }
.status-badge--yellow { background: #fef3c7; color: #b45309; }
.status-badge--red { background: #fef2f2; color: #dc2626; }

.plan-badge {
    display: inline-block;
    padding: 1px 6px;
    font-size: 11px;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 3px;
}

.alert-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    background: var(--color-danger);
    color: white;
}

.alert-count--zero {
    background: var(--color-gray-200);
    color: var(--color-gray-500);
}

/* ============================================
   Modal
   ============================================ */

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

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

.cockpit-modal h3 {
    margin: 0 0 20px;
    font-size: 18px;
}

.cockpit-form-group {
    margin-bottom: 16px;
}

.cockpit-form-group > label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-gray-600);
}

.cockpit-form-group input[type="text"],
.cockpit-form-group input[type="email"],
.cockpit-form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-gray-200);
    border-radius: 4px;
    font-size: 14px;
}

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

.cockpit-form-row {
    display: flex;
    gap: 12px;
}

.cockpit-form-row .cockpit-form-group { flex: 1; }

.cockpit-form-hint {
    font-size: 12px;
    color: var(--color-gray-400);
    margin-top: 4px;
}

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

.cockpit-form-error {
    margin-top: 12px;
    padding: 10px;
    background: #fef2f2;
    color: #dc2626;
    border-radius: 4px;
    font-size: 13px;
}

/* ============================================
   Detail Grid (Tenant-Detail)
   ============================================ */

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

.detail-section h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-gray-500);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-gray-100);
}

.check-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.check-card {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--color-gray-300);
}

.check-card--green { border-left-color: var(--status-green); }
.check-card--yellow { border-left-color: var(--status-yellow); }
.check-card--red { border-left-color: var(--status-red); }

.check-card-type {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-gray-500);
    margin-bottom: 4px;
}

.check-card-summary {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-gray-800);
}

.check-card-time {
    font-size: 11px;
    color: var(--color-gray-400);
    margin-top: 8px;
}

/* ============================================
   Alert List
   ============================================ */

.alert-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-gray-100);
    align-items: flex-start;
}

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

.alert-severity {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.alert-severity--critical { background: var(--status-red); }
.alert-severity--warning { background: var(--status-yellow); }
.alert-severity--info { background: var(--color-primary); }

.alert-content { flex: 1; }

.alert-message {
    font-size: 13px;
    color: var(--color-gray-800);
}

.alert-meta {
    font-size: 11px;
    color: var(--color-gray-400);
    margin-top: 2px;
}

.alert-ack {
    opacity: 0.5;
}

/* ============================================
   Banner
   ============================================ */

.cockpit-banner {
    padding: 14px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.6;
}

.cockpit-banner--info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.cockpit-banner--warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.cockpit-banner--success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }

/* ============================================
   Loading & Empty State
   ============================================ */

.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-gray-400);
    font-size: 15px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-gray-400);
}

/* ============================================
   Toast
   ============================================ */

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

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

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

/* ============================================
   Ampel Score (Dashboard-Tabelle)
   ============================================ */

.ampel-score {
    font-size: 11px;
    margin-left: 4px;
    font-weight: 600;
    color: var(--color-gray-600);
}

.ampel-cell {
    white-space: nowrap;
}

/* ============================================
   Score Hero (Tenant-Detail)
   ============================================ */

.score-hero {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.score-card {
    flex: 1;
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    border-top: 4px solid var(--color-gray-300);
}

.score-card--green { border-top-color: var(--status-green); }
.score-card--yellow { border-top-color: var(--status-yellow); }
.score-card--red { border-top-color: var(--status-red); }

.score-card-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-gray-500);
    margin-bottom: 4px;
}

.score-card-value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}

.score-card--green .score-card-value { color: var(--status-green); }
.score-card--yellow .score-card-value { color: var(--status-yellow); }
.score-card--red .score-card-value { color: var(--status-red); }

.score-card-sub {
    font-size: 12px;
    color: var(--color-gray-400);
}

/* ============================================
   Quick Wins / Improvements
   ============================================ */

.quick-wins {
    list-style: none;
    padding: 0;
}

.quick-wins li {
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-gray-100);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quick-wins li:last-child { border-bottom: none; }

.quick-win-category {
    font-weight: 600;
    color: var(--color-gray-700);
}

.quick-win-detail {
    color: var(--color-gray-500);
    font-size: 12px;
}

.quick-win-gain {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-primary);
    white-space: nowrap;
}

/* ============================================
   GEO Suggestions
   ============================================ */

.suggestion-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-gray-100);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

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

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

.suggestion-query {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-gray-800);
    margin-bottom: 2px;
}

.suggestion-meta {
    font-size: 11px;
    color: var(--color-gray-400);
}

.suggestion-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.suggestion-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.suggestion-status--open { background: #fef3c7; color: #b45309; }
.suggestion-status--sent { background: #dbeafe; color: #1d4ed8; }
.suggestion-status--accepted { background: #d1fae5; color: #047857; }
.suggestion-status--declined { background: #f1f5f9; color: var(--color-gray-500); }

/* ============================================
   Detail Toolbar
   ============================================ */

.detail-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 24px;
}

.detail-toolbar .btn { font-size: 12px; }

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .cockpit-nav { flex-direction: column; gap: 8px; padding: 12px 16px; }
    .cockpit-stats { flex-direction: column; }
    .cockpit-form-row { flex-direction: column; }
    .cockpit-table { font-size: 13px; }
    .cockpit-table th, .cockpit-table td { padding: 8px 10px; }
    .cockpit-modal { margin: 10px; max-width: none; }
    .check-cards { grid-template-columns: 1fr; }
    #app-content { padding: 16px; }
}
