:root {
    --primary-color: #198754;
    --secondary-color: #052767;
    --accent-color: #20c997;
    --text-dark: #2d3436;
    --bg-light: #f8f9fa;
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --border-radius: 16px;
    --glass-bg: rgba(255, 255, 255, 0.45);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-blur: blur(12px) saturate(160%);
}

/* Auto-fit and Global Responsiveness */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    background-attachment: fixed;
    color: var(--text-dark);
    font-size: clamp(0.875rem, 0.4vw + 0.75rem, 1rem); /* Auto-scaling font */
}

h1 { font-size: clamp(1.5rem, 2.5vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 2vw, 2rem); }
h3 { font-size: clamp(1.1rem, 1.5vw, 1.5rem); }

/* Unified Table Scrolling */
.table-responsive {
    border-radius: var(--border-radius);
    -webkit-overflow-scrolling: touch;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
}

/* Fix for containers on small screens */
.container-fluid {
    padding-left: clamp(0.5rem, 2vw, 1.5rem) !important;
    padding-right: clamp(0.5rem, 2vw, 1.5rem) !important;
}

/* Card Auto-sizing & Liquid Glass Effect */
.card {
    border-radius: var(--border-radius);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    position: relative;
    overflow: hidden;
}

.card::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: skewX(-25deg);
    transition: 0.75s;
}

.card:hover::after {
    left: 150%;
}

.card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.55);
}

@media (max-width: 575.98px) {
    .btn-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--secondary-color);
}

/* Ensure headings inside colored containers are readable */
.bg-dark h1, .bg-dark h2, .bg-dark h3, .bg-dark h4, .bg-dark h5, .bg-dark h6,
.bg-primary h1, .bg-primary h2, .bg-primary h3, .bg-primary h4, .bg-primary h5, .bg-primary h6,
.bg-success h1, .bg-success h2, .bg-success h3, .bg-success h4, .bg-success h5, .bg-success h6,
.bg-secondary h1, .bg-secondary h2, .bg-secondary h3, .bg-secondary h4, .bg-secondary h5, .bg-secondary h6,
.text-white h1, .text-white h2, .text-white h3, .text-white h4, .text-white h5, .text-white h6 {
    color: #ffffff !important;
}

.card-header {
    border-top-left-radius: var(--border-radius) !important;
    border-top-right-radius: var(--border-radius) !important;
    background: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid var(--glass-border);
}

.btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    backdrop-filter: blur(4px);
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.2);
}

.btn-primary:hover {
    background-color: #157347;
    border-color: #146c43;
    transform: scale(1.02);
}

.form-control, .form-select {
    border-radius: 10px;
    padding: 0.6rem 1rem;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
}

.form-control:focus {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.15);
}

/* Table Enhancements */
.table {
    background: transparent;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 0;
}

.table thead th {
    background-color: rgba(0, 0, 0, 0.04);
    border-bottom: 1px solid var(--glass-border);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: #4a5568;
}

.table tbody td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

/* Custom classes */
.fw-extra-bold { font-weight: 800; }
.tracking-tight { letter-spacing: -0.025em; }

/* Layout Auto-Fit Fixes */
@media (max-width: 767.98px) {
    .content {
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
        padding-top: 1rem !important;
    }

    .card-body {
        padding: 1rem !important;
    }

    .small-on-mobile {
        font-size: 1rem !important;
    }
}

img {
    max-width: 100%;
    height: auto;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

#blazor-error-ui {
    background: rgba(254, 215, 215, 0.8);
    backdrop-filter: blur(8px);
    color: #c53030;
    bottom: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: none;
    left: 0;
    padding: 0.8rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
    font-weight: 600;
}

#blazor-error-ui .reload {
    color: #c53030;
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 0.8rem;
}

/* Profile Text Fix */
.profile-name {
    font-weight: 700;
}

.profile-meta {
    font-size: 0.75rem;
}
