:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-bg: #f8f9fa;
    --dark-text: #212529;
    --border-color: #dee2e6;
}

html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100%;
    overflow-x: hidden;
    scroll-behavior: smooth;
    /* Handle iOS safe areas */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover, .btn-link:hover {
    text-decoration: underline;
}

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

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(13, 110, 253, 0.5);
}

.content {
    padding-top: 1.1rem;
    min-height: calc(100vh - 200px);
    flex: 1 1 auto;
    overflow-y: auto;
}

/* Ensure container-fluid takes full available height */
.content > .container-fluid {
    height: 100%;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--success-color);
}

.invalid {
    outline: 1px solid var(--danger-color);
}

.validation-message {
    color: var(--danger-color);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Jumbotron replacement for Bootstrap 5 */
.jumbotron {
    padding: 2rem 1rem;
    margin-bottom: 2rem;
    background-color: var(--light-bg);
    border-radius: 0.3rem;
}

.jumbotron .display-4 {
    font-size: 3.5rem;
    font-weight: 300;
    line-height: 1.2;
}

.jumbotron .lead {
    font-size: 1.25rem;
    font-weight: 300;
}

/* Footer Styling */
.footer {
    background-color: var(--light-bg);
    border-top: 1px solid var(--border-color);
}

/* Top Row Header */
.top-row {
    background-color: #f7f7f7;
    border-bottom: 1px solid var(--border-color);
    justify-content: flex-end;
    height: 3.5rem;
    display: flex;
    align-items: center;
}

/* Card Enhancements */
.card {
    border: 1px solid var(--border-color);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.3s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

/* Badge Enhancements */
.badge {
    padding: 0.35em 0.65em;
    font-weight: 500;
}

/* Table Enhancements */
.table {
    margin-bottom: 0;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Loading Progress */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHB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TI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--primary-color);
    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");
}

/* Responsive Design */
@media (max-width: 768px) {
    .jumbotron .display-4 {
        font-size: 2rem;
    }

    .card {
        margin-bottom: 1rem;
    }
    
    /* Improve touch targets on mobile */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better spacing on mobile */
    .content {
        padding-top: 0.5rem;
        padding-bottom: 1rem;
    }
    
    /* Reduce header size on mobile */
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
}

/* Utility Classes */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}


code {
    color: #c02d76;
}

/* Recording Indicator Animation */
.recording-indicator {
    position: relative;
    display: inline-block;
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border: 3px solid var(--danger-color);
    border-radius: 50%;
    animation: pulse 1.5s ease-out infinite;
    opacity: 0.8;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0;
    }
}

/* ── Shared Admin / Page Components ──────────────────────────────────────── */
/* Used across admin and profile pages. Defined once here to avoid duplication
   in scoped *.razor.css files. */

/* Card */
.admin-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.07);
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.admin-card-header {
    background: linear-gradient(135deg, #0a1a3a 0%, #1a2d5a 100%);
    color: #fff;
    padding: 0.85rem 1.25rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.admin-card-body {
    padding: 1rem 1.25rem;
}

/* Stat summary cards */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    border: 1px solid #e9ecef;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: #212529;
}

.stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 500;
}

/* Setting rows */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.setting-label {
    font-weight: 500;
    color: #495057;
    font-size: 0.9rem;
}

.setting-value {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Access-denied panel */
.admin-access-denied {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.access-denied-card {
    text-align: center;
    padding: 3rem 2rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 440px;
}

.access-denied-icon {
    font-size: 3.5rem;
    color: #dc3545;
    display: block;
    margin-bottom: 1rem;
}

/* Shared table styles for admin tables */
.admin-table th {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-table td {
    font-size: 0.9rem;
    vertical-align: middle;
}

/* Profile avatar */
.profile-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0a1a3a 0%, #1a2d5a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2.6rem;
}

/* Spin animation (used in admin action buttons) */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spin {
    display: inline-block;
    animation: spin 1s linear infinite;
}
