/* Import Onest Font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700&display=swap');

:root {
    /* Primary Color Palette */
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #dbeafe;
    --color-primary-dark: #1e40af;
    
    /* Secondary Colors */
    --color-secondary: #64748b;
    --color-secondary-hover: #475569;
    --color-secondary-light: #f1f5f9;
    
    /* Success, Warning, Danger */
    --color-success: #10b981;
    --color-success-light: #d1fae5;
    --color-warning: #f59e0b;
    --color-warning-light: #fef3c7;
    --color-danger: #ef4444;
    --color-danger-light: #fee2e2;
    --color-info: #06b6d4;
    --color-info-light: #cffafe;
    
    /* Neutral Grays */
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;
    
    /* Background & Surface */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-dark: #0f172a;
    
    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    
    /* Borders & Dividers */
    --border-color: #e2e8f0;
    --border-color-dark: #cbd5e1;
    --border-radius-sm: 0.375rem;
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
    --border-radius-8: 8px; /* Design system standard */
    
    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    
    /* Spacing Scale */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Typography */
    --font-sans: 'Onest', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Typography - Display */
    --text-display-lg-font-size: 56px;
    --text-display-lg-font-weight: 600;
    --text-display-lg-line-height: 140%;
    --text-display-lg-letter-spacing: -0.02em;
    
    --text-display-md-font-size: 48px;
    --text-display-md-font-weight: 600;
    --text-display-md-line-height: 140%;
    --text-display-md-letter-spacing: -0.02em;
    
    /* Typography - Headings */
    --text-heading-h1-lg-font-size: 40px;
    --text-heading-h1-lg-font-weight: 600;
    --text-heading-h1-lg-line-height: 130%;
    --text-heading-h1-lg-letter-spacing: -0.01em;
    
    --text-heading-h2-md-font-size: 32px;
    --text-heading-h2-md-font-weight: 600;
    --text-heading-h2-md-line-height: 130%;
    --text-heading-h2-md-letter-spacing: -0.01em;
    
    --text-heading-h3-sm-font-size: 28px;
    --text-heading-h3-sm-font-weight: 600;
    --text-heading-h3-sm-line-height: 130%;
    --text-heading-h3-sm-letter-spacing: 0;
    
    --text-heading-h4-xs-font-size: 24px;
    --text-heading-h4-xs-font-weight: 600;
    --text-heading-h4-xs-line-height: 120%;
    --text-heading-h4-xs-letter-spacing: 0;
    
    --text-heading-h5-2xs-font-size: 20px;
    --text-heading-h5-2xs-font-weight: 600;
    --text-heading-h5-2xs-line-height: 120%;
    --text-heading-h5-2xs-letter-spacing: 0;
    
    /* Typography - Body */
    --text-body-lg-font-size: 18px;
    --text-body-lg-font-weight: 400;
    --text-body-lg-line-height: 150%;
    --text-body-lg-letter-spacing: 0;
    
    --text-body-lg-500-font-size: 18px;
    --text-body-lg-500-font-weight: 500;
    --text-body-lg-500-line-height: 150%;
    --text-body-lg-500-letter-spacing: 0;
    
    --text-body-md-font-size: 16px;
    --text-body-md-font-weight: 400;
    --text-body-md-line-height: 150%;
    --text-body-md-letter-spacing: 0;
    
    --text-body-md-500-font-size: 16px;
    --text-body-md-500-font-weight: 500;
    --text-body-md-500-line-height: 150%;
    --text-body-md-500-letter-spacing: 0;
    
    --text-body-sm-font-size: 14px;
    --text-body-sm-font-weight: 400;
    --text-body-sm-line-height: 150%;
    --text-body-sm-letter-spacing: 0;
    
    --text-body-sm-500-font-size: 14px;
    --text-body-sm-500-font-weight: 500;
    --text-body-sm-500-line-height: 150%;
    --text-body-sm-500-letter-spacing: 0;
    
    /* Typography - Caption */
    --text-caption-md-font-size: 12px;
    --text-caption-md-font-weight: 400;
    --text-caption-md-line-height: 130%;
    --text-caption-md-letter-spacing: 0;
    
    --text-caption-md-500-font-size: 12px;
    --text-caption-md-500-font-weight: 500;
    --text-caption-md-500-line-height: 130%;
    --text-caption-md-500-letter-spacing: 0;
    
    --text-caption-sm-font-size: 10px;
    --text-caption-sm-font-weight: 400;
    --text-caption-sm-line-height: 130%;
    --text-caption-sm-letter-spacing: 0;
    
    /* Transitions */
    --transition-fast: 100ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    
    /* Fluid Typography - Scales smoothly between breakpoints */
    --text-fluid-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    --text-fluid-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
    --text-fluid-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    --text-fluid-lg: clamp(1.125rem, 1rem + 0.5vw, 1.5rem);
    --text-fluid-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.75rem);
    --text-fluid-2xl: clamp(1.5rem, 1.25rem + 1vw, 2.25rem);
    
    /* Responsive Spacing - Adapts to screen size */
    --spacing-fluid-xs: clamp(0.25rem, 0.2rem + 0.25vw, 0.5rem);
    --spacing-fluid-sm: clamp(0.5rem, 0.4rem + 0.5vw, 0.75rem);
    --spacing-fluid-md: clamp(0.75rem, 0.6rem + 0.75vw, 1rem);
    --spacing-fluid-lg: clamp(1rem, 0.8rem + 1vw, 1.5rem);
    --spacing-fluid-xl: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
}

/* ============================================
   BASE STYLES
   ============================================ */

html, body {
    font-family: var(--font-sans);
    margin: 0;
    padding: 0;
    height: 100%;
    background-color: #f5f5f5;
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


/* ============================================
   LINKS & BUTTONS
   ============================================ */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-hover);
}

.btn-link {
    color: var(--color-primary);
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color var(--transition-fast);
}

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

/* Modern Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: var(--font-weight-medium);
    line-height: 1.5;
    border-radius: var(--border-radius-8);
    border: 1px solid transparent;
    transition: all var(--transition-base);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    color: var(--text-inverse);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--color-primary-hover) 0%, var(--color-primary) 100%);
    box-shadow: var(--shadow-md);
}

.btn-primary:active:not(:disabled) {
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    color: var(--text-primary);
    background-color: var(--bg-primary);
    border-color: var(--border-color-dark);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--color-gray-50);
    border-color: var(--color-gray-400);
    color: #000 !important;
}
.btn-success {
    color: var(--text-inverse);
    background-color: var(--color-success);
    border-color: var(--color-success);
    box-shadow: var(--shadow-sm);
}

.btn-success:hover:not(:disabled) {
    background-color: #059669;
    box-shadow: var(--shadow-md);
}

.btn-danger {
    color: var(--text-inverse);
    background-color: var(--color-danger);
    border-color: var(--color-danger);
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
    box-shadow: var(--shadow-md);
}

.btn-outline-secondary {
    color: var(--text-secondary);
    background-color: transparent;
    border-color: var(--border-color-dark);
}

.btn-outline-secondary:hover:not(:disabled) {
    color: var(--text-primary);
    background-color: var(--color-gray-50);
    border-color: var(--color-gray-400);
}

.btn-outline-danger {
    color: var(--color-danger);
    background-color: transparent;
    border-color: var(--color-danger);
}

.btn-outline-danger:hover:not(:disabled) {
    color: var(--text-inverse);
    background-color: var(--color-danger);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.0625rem;
}

/* Button Icon - Design System */
.btn-icon-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-icon-circle i {
    font-size: 1.25rem;
    line-height: 1;
    font-weight: 700;
}

.btn:focus, 
.btn:active:focus, 
.btn-link.nav-link:focus, 
.form-control:focus, 
.form-check-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.content {
    padding-top: 1rem;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-fast);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: var(--font-weight-semibold);
}

.card-header h5 {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 0.875rem 1.25rem;
}

/* ============================================
   FORMS
   ============================================ */
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    font-weight: var(--font-weight-normal);
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    background-clip: padding-box;
    border: 1px solid var(--border-color-dark);
    border-radius: var(--border-radius-8);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    color: var(--text-primary);
    background-color: var(--bg-primary);
    border-color: var(--color-primary);
    outline: 0;
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-control:disabled,
.form-select:disabled {
    background-color: var(--color-gray-100);
    opacity: 0.7;
    cursor: not-allowed;
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* ============================================
   TABLES
   ============================================ */
.table {
    width: 100%;
    margin-bottom: 0;
    color: var(--text-primary);
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background-color: var(--color-gray-50);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    padding: 0.75rem 0.625rem;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    vertical-align: middle;
}

.table tbody td {
    padding: 0.75rem 0.625rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 0.875rem;
}

.table tbody tr {
    transition: background-color var(--transition-fast);
}

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

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--border-radius-lg);
}

/* Compact table columns */
.table td:first-child,
.table th:first-child {
    padding-left: 1rem;
}

.table td:last-child,
.table th:last-child {
    padding-right: 1rem;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375em 0.75em;
    font-size: 0.8125rem;
    font-weight: var(--font-weight-medium);
    line-height: 1;
    border-radius: var(--border-radius-8);
    white-space: nowrap;
}

.badge-status {
    display: inline-block;
    min-width: 75px;
    text-align: center;
}

.bg-success {
    background-color: var(--color-success-light) !important;
    color: #065f46 !important;
}

.bg-warning {
    background-color: var(--color-warning-light) !important;
    color: #92400e !important;
}

.bg-danger {
    background-color: var(--color-danger-light) !important;
    color: #991b1b !important;
}

.bg-info {
    background-color: var(--color-info-light) !important;
    color: #164e63 !important;
}

.bg-secondary {
    background-color: var(--color-secondary-light) !important;
    color: var(--color-gray-700) !important;
}

/* ============================================
   DROPDOWNS
   ============================================ */
.dropdown-menu {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    margin-top: 0.5rem;
    min-width: 12rem;
}

.dropdown-header {
    font-size: 0.8125rem;
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    color: var(--text-primary);
    background-color: transparent;
    border: none;
    border-radius: var(--border-radius);
    transition: background-color var(--transition-fast);
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background-color: var(--color-gray-50);
    color: var(--text-primary);
}

.dropdown-item.active,
.dropdown-item:active {
    background-color: var(--color-primary-light);
    color: var(--color-primary-dark);
}

.dropdown-divider {
    height: 0;
    margin: 0.5rem 0;
    overflow: hidden;
    border-top: 1px solid var(--border-color);
}


/* ============================================
   UTILITIES
   ============================================ */
.hover-shadow {
    transition: box-shadow var(--transition-fast);
}

.hover-shadow:hover {
    box-shadow: var(--shadow-lg) !important;
}

.cursor-pointer {
    cursor: pointer;
}

.text-primary {
    color: var(--color-primary) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-danger {
    color: var(--color-danger) !important;
}

.text-success {
    color: var(--color-success) !important;
}

.bg-light {
    background-color: #f5f5f5 !important;
}

.border-light {
    border-color: var(--border-color) !important;
}

/* ============================================
   VALIDATION STYLES
   ============================================ */
.valid.modified:not([type=checkbox]) {
    border-color: var(--color-success);
    box-shadow: 0 0 0 3px var(--color-success-light);
}

.invalid {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 3px var(--color-danger-light);
}

.validation-message {
    color: var(--color-danger);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ============================================
   ERROR BOUNDARY
   ============================================ */
.blazor-error-boundary {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA9NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDNTN0NzWiIgZmlsbD0iI0ZGRTUwMCIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9nPjwvc3ZnPg==);
    background-repeat: no-repeat;
    background-position: 1rem center;
    background-size: 1.8rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
    font-weight: var(--font-weight-semibold);
}

/* ============================================
   ANIMATIONS & TRANSITIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.fade-in {
    animation: fadeIn var(--transition-slow) ease-out;
}

.slide-down {
    animation: slideDown var(--transition-base) ease-out;
}

/* ============================================
   SPINNERS
   ============================================ */
.spinner-border,
.spinner-grow {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    vertical-align: -0.125em;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

.spinner-border-sm,
.spinner-grow-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   ROLE ICONS
   ============================================ */
.role-icon {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-gray-100);
    border-radius: var(--border-radius-lg);
    transition: all var(--transition-base);
}

.role-icon.admin {
    color: var(--color-primary);
    background-color: var(--color-primary-light);
}

.role-icon.doctor {
    color: var(--color-success);
    background-color: var(--color-success-light);
}

.btn-primary .role-icon {
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--text-inverse);
}

/* ============================================
   ORGANIZATION CONTEXT SELECTOR - MODERN
   ============================================ */
.org-selector-item {
    transition: all var(--transition-fast);
    border: 2px solid var(--border-color) !important;
    border-radius: var(--border-radius-lg) !important;
    background-color: var(--bg-primary);
    cursor: pointer;
    min-height: 72px;
}

.org-selector-item:hover {
    background-color: var(--color-gray-50);
    border-color: var(--color-primary) !important;
    box-shadow: var(--shadow-md);
}

.org-selector-item.active {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%) !important;
    border-color: var(--color-primary) !important;
    color: var(--text-inverse) !important;
    box-shadow: var(--shadow-lg);
}

.org-selector-item.active .role-icon {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--text-inverse) !important;
}

.org-selector-item.active small {
    color: rgba(255, 255, 255, 0.95) !important;
}

.org-selector-item .role-icon {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
}


.modal-custom-900 {
    max-width: 900px;
}

@media (max-width: 991px) {
    .modal-custom-900 {
        max-width: calc(100% - 2rem);
        margin: 1rem;
    }
}
@media (max-width: 576px) {
    .modal-lg {
        max-width: calc(100% - 2rem);
        margin: 1rem;
    }

    .org-selector-item {
        min-height: 64px;
    }

    .org-selector-item .role-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
}


/* Top Row Adjustments */
.top-row {
    z-index: 1000;
}

.card {
    transition: all 0.3s ease;
}

.text-primary {
    color: #1b6ec2 !important;
}

h1:focus {
    outline: none !important;
}

.bg-light {
    background-color: #f8f6f3 !important;
}

/* Keep existing validation styles */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

/* Keep existing error boundary styles */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA9NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDNTQ3WiIgZmlsbD0iI0ZGRTUwMCIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9nPjwvc3ZnPg==) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

/* Role Icons */
.role-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
}

    .role-icon.admin {
        color: var(--bs-primary);
    }

    .role-icon.doctor {
        color: var(--bs-success);
    }

.btn-primary .role-icon {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   RESPONSIVE STYLES - MOBILE (< 576px)
   ============================================ */
@media (max-width: 576px) {
    /* Date picker responsive */
    .daterangepicker {
        max-width: 100% !important;
        left: 10px !important;
        right: 10px !important;
    }
    
    .daterangepicker .calendar {
        max-width: 100%;
    }
    
    .daterangepicker .drp-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .daterangepicker .drp-buttons .btn {
        width: 100%;
    }
    
    /* Force compact date format on mobile */
    .form-control[type="text"] {
        font-size: 0.9rem;
    }
    
    /* Date input compact display */
    input[type="date"] {
        max-width: 100%;
    }
    
    /* Card adjustments */
    .card-body {
        padding: 1rem;
    }
    
    /* Button improvements */
    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
    
    .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    .btn-secondary i.bi {
        margin-right: 0.25rem !important;
    }
    
    /* Form controls */
    .form-control, .form-select {
        font-size: 1rem;
    }
    
    /* Badge adjustments */
    .badge {
        font-size: 0.6875rem;
        padding: 0.25em 0.5em;
    }
    
    .badge-status {
        min-width: 60px;
    }
    
    /* Gap adjustments */
    .gap-2 {
        gap: 0.5rem !important;
    }
    
    .gap-3 {
        gap: 0.75rem !important;
    }
    
    /* Modal adjustments */
    .modal-lg {
        max-width: calc(100% - 2rem);
        margin: 1rem;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }

    .org-selector-item {
        min-height: 64px;
    }

    .org-selector-item .role-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    /* Top-row compact */
    main > .top-row {
        padding: 0.4rem 0.5rem;
        gap: 0.25rem !important;
    }
    
    /* Language selector - smaller */
    .lang-selector .btn-lang {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
        min-width: 35px;
    }
    
    /* Organization button - minimal */
    .top-row .btn-link {
        padding: 0.2rem 0.4rem !important;
        font-size: 0.7rem !important;
        max-width: 140px;
    }
    
    .top-row .btn-link i.bi-briefcase {
        font-size: 0.8rem;
    }
    
    .top-row .btn-link span {
        font-size: 0.65rem;
        max-width: 90px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Logout - icon adjustments */
    .top-row a[href*="Logout"] {
        gap: 0.15rem !important;
    }
    
    .top-row a[href*="Logout"] i {
        font-size: 0.95rem;
    }
    
    .top-row a[href*="Logout"] span {
        font-size: 0.75rem;
    }
    
    /* Table improvements for mobile - COMPACT */
    .table {
        font-size: 0.8125rem;
    }
    
    .table td, .table th {
        padding: 0.5rem 0.375rem;
        vertical-align: middle;
    }
    
    .table thead th {
        font-size: 0.6875rem;
        padding: 0.625rem 0.375rem;
        letter-spacing: 0;
    }
    
    .table td:first-child,
    .table th:first-child {
        padding-left: 0.625rem;
    }

    .table td:last-child,
    .table th:last-child {
        padding-right: 0.625rem;
    }
    
    /* Child table rows - more compact */
    .table tr td p.text-muted {
        font-size: 0.75rem;
        margin-bottom: 0;
        padding-left: 0.375rem;
    }
    
    /* Dropdown menu on mobile */
    .dropdown-menu {
        min-width: 140px;
        font-size: 0.875rem;
    }
    
    .dropdown-item {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .dropdown-item i {
        font-size: 0.875rem;
    }
    
    /* Alert messages */
    .alert {
        font-size: 0.875rem;
        padding: 0.625rem 0.75rem;
    }
    
    .card-header {
        padding: 0.875rem;
    }
    
    .card-header h5 {
        font-size: 1.1rem;
    }
    
    /* Width utilities */
    .w-100-mobile {
        width: 100% !important;
    }
    
    /* Form group spacing */
    .form-group {
        margin-bottom: 0.75rem;
    }
    
    /* Validation message */
    .validation-message {
        font-size: 0.75rem;
        margin-top: 0.25rem;
    }
    
    /* Container padding */
    .container, .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* Table responsive wrapper */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
    }
    
    /* Better spacing for small text in tables */
    .small {
        font-size: 0.8rem;
    }
}

/* ============================================
   RESPONSIVE STYLES - TABLET (576px - 991px)
   ============================================ */
@media (min-width: 576px) and (max-width: 991px) {
    /* Flex utilities */
    .flex-wrap-sm {
        flex-wrap: nowrap;
    }
    
    /* Card body spacing */
    .card-body {
        padding: 1.125rem;
    }
    
    /* Row spacing */
    .row.g-3 {
        --bs-gutter-x: 0.875rem;
        --bs-gutter-y: 0.625rem;
    }
    
    /* Badge sizing */
    .badge {
        padding: 0.4375rem 0.875rem;
        font-size: 0.875rem;
    }
    
    /* Button sizing */
    .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
    }
}

/* ============================================
   RESPONSIVE STYLES - DESKTOP (≥ 992px)
   ============================================ */
@media (min-width: 992px) {
    /* Back button improvements */
    .btn-secondary {
        white-space: nowrap;
    }
}

/* ============================================
   RESPONSIVE STYLES - SMALL TABLET/LARGE MOBILE
   ============================================ */
@media (max-width: 991px) {
    /* Navbar adjustments */
    .top-row {
        flex-wrap: wrap;
    }
    
    /* Form row spacing */
    .row.g-3 {
        row-gap: 1rem !important;
    }
}

/* Flex utilities for responsive layouts */
.flex-wrap-sm {
    flex-wrap: wrap;
}

@media (min-width: 576px) {
    .flex-wrap-sm {
        flex-wrap: nowrap;
    }
}

/* Text truncation utility */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Position relative for badges */
.position-relative {
    position: relative;
}

.position-absolute {
    position: absolute;
}

/* Translation utilities */
.translate-middle-y {
    transform: translateY(-50%);
}

/* ============================================
   PAGINATION - RESPONSIVE UNIFIED
   ============================================ */

/* Wrapper container */
.pagination-wrapper {
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.75rem 0;
}

/* Summary row */
.pagination-summary-row {
    text-align: center;
    margin-bottom: 0.75rem;
}

.pagination-summary-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: var(--font-weight-medium);
}

/* Main controls row */
.pagination-main-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Page size selector */
.pagination-size-selector {
    flex: 0 0 auto;
}

.pagination-page-size-select {
    min-width: 9rem;
    padding-right: 2.5rem !important;
    padding-left: 0.75rem;
    font-size: 0.875rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem 1rem;
    border: 1px solid var(--border-color);
}

.pagination-page-size-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem var(--color-primary-light);
    outline: none;
}

/* Navigation wrapper */
.pagination-nav-wrapper {
    flex: 1 1 auto;
    display: flex;
    justify-content: flex-end;
}

/* Pagination list */
.pagination {
    display: flex;
    gap: 0.25rem;
    padding: 0;
    list-style: none;
    margin: 0;
    flex-wrap: nowrap;
}

/* Page items */
.page-item {
    display: inline-flex;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
    border: 1px solid transparent;
    background-color: transparent;
    color: var(--text-primary);
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    font-size: 0.875rem;
    text-align: center;
    line-height: 1;
}

.page-link:hover:not(:disabled) {
    background-color: var(--color-gray-100);
    border-color: transparent;
    color: var(--text-primary);
}

.page-link:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.page-item.active .page-link {
    background-color: var(--color-primary);
    border-color: transparent;
    color: white;
    font-weight: 600;
}

.page-item.active .page-link:hover {
    background-color: var(--color-primary-dark);
}

.page-item.disabled .page-link,
.page-link:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    background-color: transparent;
    color: var(--text-secondary);
}

/* Arrow buttons - always visible */
.pagination-arrow {
    min-width: 2.5rem;
    padding: 0.5rem;
}

.pagination-arrow i {
    font-size: 1rem;
    line-height: 1;
}

/* Ellipsis */
.pagination-ellipsis .page-link {
    cursor: default;
    background-color: transparent;
    border-color: transparent;
}

/* Tablet (576px - 991px) */
@media (min-width: 576px) and (max-width: 991px) {
    .pagination-main-controls {
        gap: 0.75rem;
    }
    
    .page-link {
        padding: 0.4rem 0.65rem;
        min-width: 2.25rem;
        min-height: 2.25rem;
        font-size: 0.8125rem;
    }
}

/* Mobile (< 576px) */
@media (max-width: 576px) {
    .pagination-wrapper {
        margin-top: 1rem;
    }
    
    .pagination-summary-row {
        margin-bottom: 0.5rem;
    }
    
    .pagination-summary-text {
        font-size: 0.8125rem;
    }
    
    .pagination-main-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.625rem;
    }
    
    .pagination-size-selector {
        width: 100%;
    }
    
    .pagination-page-size-select {
        width: 100%;
        min-width: 100%;
        font-size: 0.8125rem;
    }
    
    .pagination-nav-wrapper {
        justify-content: center;
        width: 100%;
    }
    
    .pagination {
        gap: 0.2rem;
    }
    
    .page-link {
        padding: 0.4rem 0.5rem;
        min-width: 2rem;
        min-height: 2rem;
        font-size: 0.75rem;
    }
    
    .pagination-arrow {
        min-width: 2rem;
        padding: 0.4rem;
    }
    
    .pagination-arrow i {
        font-size: 0.875rem;
    }
}

/* ============================================
   MODALS
   ============================================ */
.modal-content {
    border: none;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: visible;
}

.modal-header {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
}

.modal-header .modal-title {
    font-size: 1.25rem;
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.modal-backdrop {
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-lg);
    border: 1px solid transparent;
    font-size: 0.9375rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: var(--color-success-light);
    border-color: var(--color-success);
    color: #065f46;
}

.alert-danger {
    background-color: var(--color-danger-light);
    border-color: var(--color-danger);
    color: #991b1b;
}

.alert-warning {
    background-color: var(--color-warning-light);
    border-color: var(--color-warning);
    color: #92400e;
}

.alert-info {
    background-color: var(--color-info-light);
    border-color: var(--color-info);
    color: #164e63;
}

/* ============================================
   SCROLLBAR CUSTOMIZATION
   ============================================ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-gray-100);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--color-gray-400);
    border-radius: 10px;
    transition: background var(--transition-fast);
}

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

/* ============================================
   LOADING STATES
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, 
        var(--color-gray-200) 25%, 
        var(--color-gray-100) 50%, 
        var(--color-gray-200) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--border-radius);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.shadow-md {
    box-shadow: var(--shadow-md) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}

.shadow-xl {
    box-shadow: var(--shadow-xl) !important;
}

.rounded {
    border-radius: var(--border-radius) !important;
}

.rounded-lg {
    border-radius: var(--border-radius-lg) !important;
}

.rounded-xl {
    border-radius: var(--border-radius-xl) !important;
}

/* Spacing utilities */
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.gap-5 { gap: 2rem !important; }

/* Fluid Typography Utilities */
.text-fluid-xs { font-size: var(--text-fluid-xs) !important; }
.text-fluid-sm { font-size: var(--text-fluid-sm) !important; }
.text-fluid-base { font-size: var(--text-fluid-base) !important; }
.text-fluid-lg { font-size: var(--text-fluid-lg) !important; }
.text-fluid-xl { font-size: var(--text-fluid-xl) !important; }
.text-fluid-2xl { font-size: var(--text-fluid-2xl) !important; }

/* Fluid Spacing Utilities */
.p-fluid-xs { padding: var(--spacing-fluid-xs) !important; }
.p-fluid-sm { padding: var(--spacing-fluid-sm) !important; }
.p-fluid-md { padding: var(--spacing-fluid-md) !important; }
.p-fluid-lg { padding: var(--spacing-fluid-lg) !important; }
.p-fluid-xl { padding: var(--spacing-fluid-xl) !important; }

.m-fluid-xs { margin: var(--spacing-fluid-xs) !important; }
.m-fluid-sm { margin: var(--spacing-fluid-sm) !important; }
.m-fluid-md { margin: var(--spacing-fluid-md) !important; }
.m-fluid-lg { margin: var(--spacing-fluid-lg) !important; }
.m-fluid-xl { margin: var(--spacing-fluid-xl) !important; }

.gap-fluid-xs { gap: var(--spacing-fluid-xs) !important; }
.gap-fluid-sm { gap: var(--spacing-fluid-sm) !important; }
.gap-fluid-md { gap: var(--spacing-fluid-md) !important; }
.gap-fluid-lg { gap: var(--spacing-fluid-lg) !important; }
.gap-fluid-xl { gap: var(--spacing-fluid-xl) !important; }

/* ============================================
   TABLE ACTION BUTTONS - COMPACT
   ============================================ */
.table .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.table .dropdown-toggle {
    min-width: auto;
}

/* Three dots button compact */
.btn-outline-secondary.btn-sm {
    padding: 0.25rem 0.5rem;
}

/* Compact dates in table */
.table td {
    white-space: nowrap;
}

/* Status badges in table */
.table .badge {
    font-size: 0.75rem;
    padding: 0.3em 0.6em;
}

/* Make certificate number column narrower */
.table td:first-child {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   CERTIFICATES LIST - UNIFIED RESPONSIVE
   ============================================ */

/* Base styles - Desktop */
.certificates-list-card {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.certificates-list-body {
    padding: 1.25rem 1.5rem;
}

.certificates-table-wrapper {
    min-height: 320px;
}

.certificates-table {
    table-layout: auto;
    width: 100%;
}

.certificates-table th,
.certificates-table td {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Large Desktop (≥ 1200px) */
@media (min-width: 1200px) {
    .certificates-list-body {
        padding: 1.5rem 2rem;
    }
}

/* Tablet (576px - 991px) */
@media (min-width: 576px) and (max-width: 991px) {
    .certificates-list-card {
        max-width: 100%;
        margin: 0 1rem;
        border-radius: var(--border-radius-lg);
    }
    
    .certificates-list-body {
        padding: 1rem 1rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table td, .table th {
        padding: 0.625rem 0.5rem;
    }
    
    .table thead th {
        font-size: 0.7rem;
    }
    
    .certificates-mobile-card {
        border-radius: var(--border-radius-lg);
    }
    
    .certificates-mobile-list .card-body {
        padding: 1rem 1rem 0.875rem;
    }
    
    .certificates-mobile-card .card-title {
        font-size: 1rem;
    }
    
    .certificates-mobile-card .small {
        font-size: 0.85rem;
    }
}

/* Mobile (<= 576px) */
@media (max-width: 576px) {
    .certificates-list-card {
        border-radius: 0;
        box-shadow: none;
        border-left: none;
        border-right: none;
        margin: 0;
    }
    
    .certificates-list-body {
        padding: 0.75rem 0.5rem 1rem;
    }

    .certificates-mobile-card {
        border-radius: var(--border-radius-lg);
    }

    .certificates-mobile-list .card-body {
        padding: 0.875rem 0.875rem 0.75rem;
    }
    
    .certificates-mobile-card .card-title {
        font-size: 0.95rem;
    }
    
    .certificates-mobile-card .small {
        font-size: 0.8rem;
    }
}

/* Checkbox styling for "EmittedOutside" on create certificate */
.emitted-outside-checkbox {
    accent-color: var(--color-primary);
}

.emitted-outside-checkbox:disabled {
    accent-color: var(--color-gray-400);
}

/* ============================================
   CERTIFICATE DETAILS PAGE - RESPONSIVE HEADER
   ============================================ */

.certificate-header-wrapper {
    min-height: 48px;
}

.certificate-page-title {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.3;
    word-break: break-word;
    flex: 1 1 auto;
    min-width: 0;
}

.certificate-page-actions {
    flex-shrink: 0;
}

/* Tablet (576px - 991px) */
@media (min-width: 576px) and (max-width: 991px) {
    .certificate-page-title {
        font-size: 1.5rem;
    }
}

/* Mobile (<= 576px) */
@media (max-width: 576px) {
    .certificate-header-wrapper {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
    
    .certificate-page-title {
        font-size: 1.25rem;
        width: 100%;
    }
    
    .certificate-page-actions {
        width: 100%;
        justify-content: flex-start;
        flex-direction: column;
        gap: 0.5rem !important;
    }
    
    .certificate-page-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   TYPOGRAPHY UTILITY CLASSES
   ============================================ */

/* Display */
.text-display-lg {
    font-family: var(--font-sans);
    font-size: var(--text-display-lg-font-size);
    font-style: normal;
    font-weight: var(--text-display-lg-font-weight);
    line-height: var(--text-display-lg-line-height);
    letter-spacing: var(--text-display-lg-letter-spacing);
}

.text-display-md {
    font-family: var(--font-sans);
    font-size: var(--text-display-md-font-size);
    font-style: normal;
    font-weight: var(--text-display-md-font-weight);
    line-height: var(--text-display-md-line-height);
    letter-spacing: var(--text-display-md-letter-spacing);
}

/* Headings */
.text-heading-h1-lg,
h1 {
    font-family: var(--font-sans);
    font-size: var(--text-heading-h1-lg-font-size);
    font-style: normal;
    font-weight: var(--text-heading-h1-lg-font-weight);
    line-height: var(--text-heading-h1-lg-line-height);
    letter-spacing: var(--text-heading-h1-lg-letter-spacing);
}

.text-heading-h2-md,
h2 {
    font-family: var(--font-sans);
    font-size: var(--text-heading-h2-md-font-size);
    font-style: normal;
    font-weight: var(--text-heading-h2-md-font-weight);
    line-height: var(--text-heading-h2-md-line-height);
    letter-spacing: var(--text-heading-h2-md-letter-spacing);
}

.text-heading-h3-sm,
h3 {
    font-family: var(--font-sans);
    font-size: var(--text-heading-h3-sm-font-size);
    font-style: normal;
    font-weight: var(--text-heading-h3-sm-font-weight);
    line-height: var(--text-heading-h3-sm-line-height);
    letter-spacing: var(--text-heading-h3-sm-letter-spacing);
}

.text-heading-h4-xs,
h4 {
    font-family: var(--font-sans);
    font-size: var(--text-heading-h4-xs-font-size);
    font-style: normal;
    font-weight: var(--text-heading-h4-xs-font-weight);
    line-height: var(--text-heading-h4-xs-line-height);
    letter-spacing: var(--text-heading-h4-xs-letter-spacing);
}

.text-heading-h5-2xs,
h5 {
    font-family: var(--font-sans);
    font-size: var(--text-heading-h5-2xs-font-size);
    font-style: normal;
    font-weight: var(--text-heading-h5-2xs-font-weight);
    line-height: var(--text-heading-h5-2xs-line-height);
    letter-spacing: var(--text-heading-h5-2xs-letter-spacing);
}

/* Body */
.text-body-lg {
    font-family: var(--font-sans);
    font-size: var(--text-body-lg-font-size);
    font-style: normal;
    font-weight: var(--text-body-lg-font-weight);
    line-height: var(--text-body-lg-line-height);
    letter-spacing: var(--text-body-lg-letter-spacing);
}

.text-body-lg-500 {
    font-family: var(--font-sans);
    font-size: var(--text-body-lg-500-font-size);
    font-style: normal;
    font-weight: var(--text-body-lg-500-font-weight);
    line-height: var(--text-body-lg-500-line-height);
    letter-spacing: var(--text-body-lg-500-letter-spacing);
}

.text-body-md {
    font-family: var(--font-sans);
    font-size: var(--text-body-md-font-size);
    font-style: normal;
    font-weight: var(--text-body-md-font-weight);
    line-height: var(--text-body-md-line-height);
    letter-spacing: var(--text-body-md-letter-spacing);
}

.text-body-md-500 {
    font-family: var(--font-sans);
    font-size: var(--text-body-md-500-font-size);
    font-style: normal;
    font-weight: var(--text-body-md-500-font-weight);
    line-height: var(--text-body-md-500-line-height);
    letter-spacing: var(--text-body-md-500-letter-spacing);
}

.text-body-sm {
    font-family: var(--font-sans);
    font-size: var(--text-body-sm-font-size);
    font-style: normal;
    font-weight: var(--text-body-sm-font-weight);
    line-height: var(--text-body-sm-line-height);
    letter-spacing: var(--text-body-sm-letter-spacing);
}

.text-body-sm-500 {
    font-family: var(--font-sans);
    font-size: var(--text-body-sm-500-font-size);
    font-style: normal;
    font-weight: var(--text-body-sm-500-font-weight);
    line-height: var(--text-body-sm-500-line-height);
    letter-spacing: var(--text-body-sm-500-letter-spacing);
}

/* Caption */
.text-caption-md {
    font-family: var(--font-sans);
    font-size: var(--text-caption-md-font-size);
    font-style: normal;
    font-weight: var(--text-caption-md-font-weight);
    line-height: var(--text-caption-md-line-height);
    letter-spacing: var(--text-caption-md-letter-spacing);
}

.text-caption-md-500 {
    font-family: var(--font-sans);
    font-size: var(--text-caption-md-500-font-size);
    font-style: normal;
    font-weight: var(--text-caption-md-500-font-weight);
    line-height: var(--text-caption-md-500-line-height);
    letter-spacing: var(--text-caption-md-500-letter-spacing);
}

.text-caption-sm {
    font-family: var(--font-sans);
    font-size: var(--text-caption-sm-font-size);
    font-style: normal;
    font-weight: var(--text-caption-sm-font-weight);
    line-height: var(--text-caption-sm-line-height);
    letter-spacing: var(--text-caption-sm-letter-spacing);
}

/* ============================================
   ADDITIONAL UTILITIES
   ============================================ */

/* Better row spacing for form elements */
.row.g-3 {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 0.75rem;
}

/* Section titles */
h5 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

/* Fix for overflow issues in flex containers */
.d-flex.flex-wrap {
    overflow: visible;
}

/* Ensure proper alignment in flex containers */
.align-items-center {
    align-items: center !important;
}

.align-items-end {
    align-items: flex-end !important;
}

/* Form group spacing */
.form-group {
    margin-bottom: 1rem;
}

/* ============================================
   SHORT HEIGHT SCREENS (< 800px)
   ============================================ */
@media (max-height: 800px) {
    /* Modal positioning - start from top instead of center */
    .modal-dialog-centered {
        align-items: flex-start !important;
        min-height: auto !important;
        margin-top: 1.5rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    /* Modal content - constrain height and enable scrolling */
    .modal-content {
        max-height: calc(100vh - 3rem) !important;
        display: flex;
        flex-direction: column;
    }
    
    /* Modal header - keep fixed at top */
    .modal-header {
        flex-shrink: 0;
        padding: 1rem 1.25rem;
    }
    
    /* Modal body - scrollable area */
    .modal-body {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        max-height: calc(100vh - 200px) !important;
        padding: 1rem 1.25rem;
        /* Add extra padding at bottom to ensure DateRangePicker is fully visible */
        padding-bottom: 2rem !important;
    }
    
    /* Modal footer - keep fixed at bottom */
    .modal-footer {
        flex-shrink: 0;
        padding: 0.875rem 1.25rem;
    }
    
    /* DateRangePicker - scale down to fit better */
    div.daterangepicker {
        transform: scale(0.9) !important;
        transform-origin: top center !important;
        margin-bottom: 1rem !important;
    }
    
    /* DateRangePicker calendars - reduce padding */
    div.daterangepicker .drp-calendar {
        padding: 8px !important;
    }
    
    /* DateRangePicker cells - smaller */
    div.daterangepicker .table-condensed td,
    div.daterangepicker .table-condensed th {
        width: 30px !important;
        height: 30px !important;
        font-size: 11px !important;
        padding: 3px !important;
    }
    
    /* DateRangePicker month header */
    div.daterangepicker .month {
        font-size: 13px !important;
        padding: 4px 0 8px 0 !important;
    }
    
    /* DateRangePicker selects - smaller */
    div.daterangepicker .monthselect,
    div.daterangepicker .yearselect {
        font-size: 12px !important;
        padding: 3px 6px !important;
    }
    
    /* DateRangePicker buttons container */
    div.daterangepicker .drp-buttons {
        padding: 8px 10px !important;
    }
    
    /* DateRangePicker buttons */
    div.daterangepicker .drp-buttons .btn {
        padding: 5px 14px !important;
        font-size: 13px !important;
    }
    
    /* Ensure form groups have proper spacing */
    .form-group {
        margin-bottom: 1rem !important;
    }
    
    /* Add scroll hint shadow */
    .modal-body::after {
        content: '';
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        height: 20px;
        background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.05));
        pointer-events: none;
    }
}

/* ============================================
   MOBILE OPTIMIZATIONS FOR DATEPICKER (< 576px)
   ============================================ */
@media (max-width: 576px) {
    /* DateRangePicker - even more compact on mobile */
    div.daterangepicker {
        transform: scale(0.85) !important;
        transform-origin: top center !important;
        max-width: 100% !important;
        left: 50% !important;
        transform: translateX(-50%) scale(0.85) !important;
    }
    
    /* DateRangePicker in modal - ensure it fits */
    .modal-body div.daterangepicker {
        max-height: calc(100vh - 250px) !important;
        overflow-y: auto !important;
    }
    
    /* Calendar containers side by side but smaller */
    div.daterangepicker .drp-calendar {
        padding: 6px !important;
    }
    
    /* Smaller cells on mobile */
    div.daterangepicker .table-condensed td,
    div.daterangepicker .table-condensed th {
        width: 28px !important;
        height: 28px !important;
        font-size: 10px !important;
        padding: 2px !important;
    }
    
    /* Compact month header */
    div.daterangepicker .month {
        font-size: 12px !important;
        padding: 3px 0 6px 0 !important;
    }
    
    /* Smaller dropdowns */
    div.daterangepicker .monthselect,
    div.daterangepicker .yearselect {
        font-size: 11px !important;
        padding: 2px 4px !important;
    }
    
    /* Stack buttons vertically on very small screens */
    div.daterangepicker .drp-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding: 8px !important;
    }
    
    div.daterangepicker .drp-buttons .btn {
        width: 100% !important;
        padding: 6px 12px !important;
        font-size: 13px !important;
    }
}

/* ============================================
   TABLET OPTIMIZATIONS FOR DATEPICKER (576px - 991px)
   ============================================ */
@media (min-width: 576px) and (max-width: 991px) {
    div.daterangepicker {
        transform: scale(0.92) !important;
        transform-origin: top center !important;
    }
    
    div.daterangepicker .table-condensed td,
    div.daterangepicker .table-condensed th {
        width: 32px !important;
        height: 32px !important;
    }
}
