html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin-bottom: 60px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #212529;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Focus styles */
.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 #258cfb;
}

/* Navigation styles */
.navbar-brand {
    font-weight: 600;
    color: #ffffff !important;
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255,255,255,.8) !important;
}

.navbar-dark .navbar-brand {
    color: #ffffff !important;
}

/* Card styles */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: all 0.3s ease;
    background-color: #ffffff;
    color: #212529;
}

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

.card-header {
    background-color: #f8f9fa;
    color: #495057;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
}

.card-body {
    color: #212529;
}

.card-title {
    color: #212529;
    font-weight: 600;
}

.card-text {
    color: #495057;
}

/* Table styles - enhance Bootstrap 5 tables */
.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(0, 0, 0, 0.05);
    --bs-table-hover-bg: rgba(0, 0, 0, 0.075);
}

.table-dark {
    --bs-table-bg: #212529;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.05);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.075);
    color: #fff;
}

.table-responsive {
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Text colors */
.text-primary {
    color: #0d6efd !important;
}

.text-success {
    color: #198754 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-warning {
    color: #fd7e14 !important;
}

.text-info {
    color: #0dcaf0 !important;
}

.text-muted {
    color: #6c757d !important;
}

.text-white {
    color: #ffffff !important;
}

.text-dark {
    color: #212529 !important;
}

.text-gray-800 {
    color: #343a40 !important;
}

.text-gray-600 {
    color: #6c757d !important;
}

.text-gray-500 {
    color: #adb5bd !important;
}

.text-gray-300 {
    color: #dee2e6 !important;
}

/* Badge styles - enhance Bootstrap 5 badges */
.badge {
    font-weight: 500;
    letter-spacing: 0.025em;
}

/* Button styles - enhance Bootstrap 5 buttons */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease;
    min-height: 38px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
}

.btn-sm {
    min-height: 32px;
}

/* Form styles */
.form-label {
    font-weight: 600;
    color: #495057;
}

.form-control {
    color: #212529;
    background-color: #ffffff;
    border: 1px solid #ced4da;
}

.form-control:focus {
    color: #212529;
    background-color: #ffffff;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-select {
    color: #212529;
    background-color: #ffffff;
    border: 1px solid #ced4da;
}

/* Alert styles */
.alert {
    border: none;
    border-radius: 0.5rem;
    border: 1px solid transparent;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
    border-color: #badbcc;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c2c7;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-color: #b6effb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
    border-color: #ffecb5;
}

/* Pagination styles */
.pagination .page-link {
    border-radius: 0.375rem;
    margin: 0 0.25rem;
    color: #0d6efd;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
}

.pagination .page-item.active .page-link {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff;
}

.pagination .page-link:hover {
    color: #0a58ca;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

/* Custom border colors */
.border-left-primary {
    border-left: 0.25rem solid #0d6efd !important;
}

.border-left-success {
    border-left: 0.25rem solid #198754 !important;
}

.border-left-info {
    border-left: 0.25rem solid #0dcaf0 !important;
}

.border-left-warning {
    border-left: 0.25rem solid #ffc107 !important;
}

/* Shadow utilities */
.shadow {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

/* Mobile responsive styles */
@media (max-width: 576px) {
    .container, .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }

    html {
        font-size: 13px;
    }

    .navbar-nav {
        text-align: center;
    }

    .btn-mobile-full {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .table-responsive {
        font-size: 0.85rem;
    }

    .card {
        margin-bottom: 1rem;
    }

    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .btn {
        min-height: 44px; /* Touch-friendly */
        padding: 0.75rem 1rem;
    }

    .btn-sm {
        min-height: 38px;
        padding: 0.5rem 0.75rem;
    }

    /* Better table display on mobile */
    .table-responsive table {
        font-size: 0.85rem;
    }

    .table-responsive th,
    .table-responsive td {
        padding: 0.5rem;
        white-space: nowrap;
    }

    /* Stack button groups vertically on mobile */
    .btn-group-mobile {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Medium screens */
@media (max-width: 768px) {
    .col-md-6 {
        margin-bottom: 1rem;
    }

    .table-responsive {
        border-radius: 0.25rem;
    }
}

/* Utility classes for consistent spacing */
.mb-4 {
    margin-bottom: 1.5rem !important;
}

.p-2 {
    padding: 0.5rem !important;
}

.py-3 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

.py-2 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

.h-100 {
    height: 100% !important;
}

.w-100 {
    width: 100% !important;
}

/* Additional font weights */
.font-weight-bold {
    font-weight: 700 !important;
}

.font-weight-normal {
    font-weight: 400 !important;
}

/* Enhanced readability for specific combinations */
.bg-warning {
    color: #000 !important;
}

.bg-info {
    color: #000 !important;
}

/* Fix any remaining contrast issues */
h1, h2, h3, h4, h5, h6 {
    color: #212529;
}

p {
    color: #495057;
}

label {
    color: #495057;
}

/* Ensure dropdown menus are visible */
.dropdown-menu {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175);
}

.dropdown-item {
    color: #212529;
}

.dropdown-item:hover {
    color: #ffffff;
    background-color: #0d6efd;
}

/* Icon colors */
.fas, .fa {
    color: inherit;
}

.text-gray-300 .fas,
.text-gray-300 .fa {
    color: #dee2e6 !important;
}