/* ---- OpSemble Theme ---- */
:root {
    --brand-accent: #2563eb;
    --brand-accent-hover: #1d4ed8;
    --brand-secondary: #7c3aed;
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-light: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --radius: 0.5rem;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; color: var(--text-primary); }
h1:focus { outline: none; }

/* ---- Links & Buttons ---- */
a, .btn-link { color: var(--brand-accent); }
a:hover { color: var(--brand-accent-hover); }

.btn { border-radius: var(--radius); font-weight: 500; transition: all 0.15s ease; }
.btn-sm { font-size: 0.8125rem; padding: 0.375rem 0.75rem; }

.btn-primary { color: #fff; background: var(--brand-accent); border-color: var(--brand-accent); box-shadow: var(--shadow-sm); }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active { background: var(--brand-accent-hover); border-color: var(--brand-accent-hover); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.btn-outline-primary { color: var(--brand-accent); border-color: var(--brand-accent); }
.btn-outline-primary:hover { color: #fff; background: var(--brand-accent); border-color: var(--brand-accent); }

.btn-success { border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.btn-outline-danger { border-radius: var(--radius); }

/* ---- Form Controls ---- */
.form-control, .form-select {
    border-radius: var(--radius);
    border-color: var(--border-light);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.form-label { font-weight: 500; color: var(--text-secondary); margin-bottom: 0.25rem; }

/* ---- Cards ---- */
.card {
    border-radius: 0.625rem;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-card);
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
}
.card-body { padding: 1rem; }

/* ---- Tables ---- */
.table { font-size: 0.875rem; }
.table thead th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-light);
}
.table-hover tbody tr:hover { background: #f1f5f9; cursor: pointer; }
.table-light { background: #f8fafc; }

/* ---- Badges ---- */
.badge {
    font-weight: 500;
    font-size: 0.7rem;
    padding: 0.3em 0.6em;
    border-radius: 0.375rem;
}

/* ---- Modals ---- */
.modal-content {
    border-radius: 0.75rem;
    border: none;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal-header { border-bottom: 1px solid var(--border-light); padding: 1rem 1.25rem; }
.modal-header .modal-title { font-size: 1.125rem; font-weight: 600; }
.modal-body { padding: 1.25rem; }
.modal-footer { border-top: 1px solid var(--border-light); padding: 0.75rem 1.25rem; }

/* ---- Progress bars ---- */
.progress { border-radius: 1rem; background: #e2e8f0; }
.progress-bar { border-radius: 1rem; }

/* ---- Alerts ---- */
.alert { border-radius: var(--radius); font-size: 0.875rem; }

/* ---- KPI Cards ---- */
.card .fs-4 { font-weight: 700; }
.card .text-muted.small { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; }

/* ---- Focus ring ---- */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ---- Brand utilities ---- */
.bg-brand-secondary { background-color: var(--brand-secondary) !important; }
.text-brand-secondary { color: var(--brand-secondary) !important; }
.content { padding-top: 1.1rem; }

/* ---- Validation ---- */
.valid.modified:not([type=checkbox]) { outline: 1px solid #16a34a; }
.invalid { outline: 1px solid #dc2626; }
.validation-message { color: #dc2626; }

/* ---- Error UI ---- */
#blazor-error-ui {
    background: #fef3c7;
    bottom: 0;
    box-shadow: 0 -1px 4px rgba(0,0,0,0.1);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: 0.875rem;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary {
    background: #dc2626;
    padding: 1rem 1rem 1rem 1rem;
    color: white;
    border-radius: var(--radius);
}
.blazor-error-boundary::after { content: "An error has occurred." }

/* ---- Loading ---- */
.loading-progress { position: relative; display: block; width: 8rem; height: 8rem; margin: 20vh auto 1rem auto; }
.loading-progress circle { fill: none; stroke: #e2e8f0; stroke-width: 0.6rem; transform-origin: 50% 50%; transform: rotate(-90deg); }
.loading-progress circle:last-child { stroke: var(--brand-accent); stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%; transition: stroke-dasharray 0.05s ease-in-out; }
.loading-progress-text { position: absolute; text-align: center; font-weight: bold; inset: calc(20vh + 3.25rem) 0 auto 0.2rem; }
.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Loading"); }

code { color: #c026d3; }
