/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    height: 100%;
}

a { color: inherit; text-decoration: none; }

/* ===== App Layout ===== */
.app-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 16px 24px;
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.app-brand {
    font-size: 20px;
    font-weight: 700;
    color: white;
}

.app-subtitle {
    font-size: 13px;
    opacity: 0.7;
}

.app-main {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ===== Dashboard ===== */
.dashboard h1 {
    font-size: 22px;
    margin-bottom: 20px;
}

.tenant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.tenant-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s, transform 0.2s;
    display: block;
    cursor: pointer;
}

.tenant-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.tenant-name {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
}

.tenant-db {
    font-size: 12px;
    color: #888;
    margin-bottom: 12px;
}

.tenant-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.report-date {
    font-size: 13px;
    color: #666;
}

/* ===== Status Badges ===== */
.status-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.status-badge.status-green { background: #d4edda; color: #0d7a3e; }
.status-badge.status-yellow { background: #fff3cd; color: #856404; }
.status-badge.status-red { background: #f8d7da; color: #721c24; }
.status-badge.status-unknown { background: #e2e3e5; color: #666; }

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-dot.status-green { background: #28a745; }
.status-dot.status-yellow { background: #ffc107; }
.status-dot.status-red { background: #dc3545; }
.status-dot.status-unknown { background: #adb5bd; }

/* ===== Reports Page ===== */
.reports-header {
    margin-bottom: 20px;
}

.back-link {
    font-size: 13px;
    color: #4a6cf7;
    display: inline-block;
    margin-bottom: 8px;
}

.back-link:hover { text-decoration: underline; }

.reports-header h1 {
    font-size: 22px;
    margin-bottom: 2px;
}

.tenant-db-label {
    font-size: 12px;
    color: #888;
}

.reports-layout {
    display: flex;
    gap: 20px;
    height: calc(100vh - 180px);
}

.report-list {
    width: 200px;
    flex-shrink: 0;
    background: white;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
    overflow-y: auto;
}

.report-list h2 {
    font-size: 15px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e8e8e8;
}

.report-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    color: #333;
}

.report-item:hover { background: #f0f2f5; }
.report-item.active { background: #e8ecff; font-weight: 600; }

.report-viewer {
    flex: 1;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
    overflow: hidden;
}

.report-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.no-selection {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 15px;
}

.no-reports {
    color: #999;
    font-size: 13px;
}

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    width: 360px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.login-card h1 {
    font-size: 22px;
    margin-bottom: 4px;
    color: #1a1a2e;
}

.login-subtitle {
    font-size: 13px;
    color: #888;
    margin-bottom: 24px;
}

.login-error {
    background: #f8d7da;
    color: #721c24;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74,108,247,0.1);
}

.login-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.login-btn:hover { opacity: 0.9; }

/* ===== Logout Link ===== */
.logout-link {
    margin-left: auto;
    font-size: 13px;
    color: rgba(255,255,255,0.7);
}

.logout-link:hover { color: white; }

/* ===== Error UI ===== */
#blazor-error-ui {
    background: #b32121;
    color: white;
    padding: 0.5rem 1rem;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1000;
    display: none;
}

#blazor-error-ui[style] { display: block; }
#blazor-error-ui .reload { color: #fff; font-weight: bold; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }
