/**
 * Bootstrap 5 Bridge CSS
 * 
 * Purpose: Handle transition from Bootstrap 3 to Bootstrap 5
 * - Provides custom brand colors and spacing
 * - Handles fallbacks for legacy patterns
 * - Ensures smooth integration with existing custom CSS
 */

:root {
    /* MCT Brand Colors */
    --mct-primary: #db2777;
    --mct-secondary: #2563eb;
    --mct-accent: #ff6b35;
    --mct-success: #10b981;
    --mct-warning: #f59e0b;
    --mct-danger: #ef4444;
    --mct-info: #06b6d4;
    
    /* Custom Spacing */
    --mct-spacing-xs: 0.25rem;
    --mct-spacing-sm: 0.5rem;
    --mct-spacing-md: 1rem;
    --mct-spacing-lg: 1.5rem;
    --mct-spacing-xl: 2rem;
    --mct-spacing-2xl: 3rem;
}

/* Override Bootstrap brand colors if needed */
.btn-primary {
    background-color: var(--mct-primary);
    border-color: var(--mct-primary);
}

.btn-primary:hover {
    background-color: #c0226b;
    border-color: #c0226b;
}

.btn-secondary {
    background-color: var(--mct-secondary);
    border-color: var(--mct-secondary);
}

.btn-secondary:hover {
    background-color: #1e40af;
    border-color: #1e40af;
}

/* Link colors */
a {
    color: var(--mct-secondary);
}

a:hover {
    color: #1e40af;
}

/* Navigation styling */
.mct-navbar {
    background: linear-gradient(135deg, var(--mct-primary) 0%, var(--mct-secondary) 100%);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
}

.brand-text {
    color: white;
}

.brand-text em {
    font-style: normal;
    color: #fbbf24;
    font-weight: 500;
}

.brand-text strong {
    font-weight: 700;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: white;
}

/* Button styles */
.btn-login {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
}

.btn-login:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

/* Sticky navbar support (Bootstrap 5 native) */
.sticky-top {
    position: sticky;
    top: 0;
    z-index: 1020;
}

/* Clearfix (Bootstrap 5 supports it natively) */
.clearfix::after {
    display: table;
    clear: both;
    content: "";
}

/* Form group spacing (replaces .form-group → .mb-3 in Bootstrap 5) */
.form-group {
    margin-bottom: 1rem;
}

/* Legacy table-responsive support */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Custom form control styling */
.form-control:focus {
    border-color: var(--mct-secondary);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

/* Alert customization */
.alert-primary {
    background-color: #ede9fe;
    border-color: #ddd6fe;
    color: #4c1d95;
}

.alert-danger {
    background-color: #fee2e2;
    border-color: #fecaca;
    color: #7f1d1d;
}

.alert-warning {
    background-color: #fffbeb;
    border-color: #fcd34d;
    color: #78350f;
}

.alert-success {
    background-color: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

/* Badge customization */
.badge {
    font-weight: 600;
    padding: 0.375rem 0.75rem;
}

/* Modal customization */
.modal-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e5e7eb;
    padding: 1.5rem;
}

/* Dropdown menu styling */
.dropdown-menu {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.dropdown-item:hover {
    background-color: #f3f4f6;
    color: var(--mct-secondary);
}

/* Card styling */
.card {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem;
}

/* Pagination styling */
.pagination .page-link {
    color: var(--mct-secondary);
}

.pagination .page-link:hover {
    background-color: #f3f4f6;
    border-color: var(--mct-secondary);
    color: var(--mct-secondary);
}

.pagination .page-item.active .page-link {
    background-color: var(--mct-secondary);
    border-color: var(--mct-secondary);
}

/* Responsive utilities */
@media (max-width: 768px) {
    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
    }

    .mct-navbar {
        flex-direction: column;
        gap: 1rem;
    }

    /* Phase 3.3 visual-audit F-03: at tablet width the public-site
       header rendered as a stacked overlay across the page. Three
       fixes lay out the layout cleanly:

       1. The Login/Register/Find-Trials buttons live in an inline
          flex div with no class hook. Wrap them and centre at narrow
          widths so they can't overflow horizontally past the navbar.
       2. The .mct-public-sidebar (Research Volunteers / Sites /
          Sponsors links) is a 180px-min-width left column; at <=768px
          it overlapped the page content. Hide it -- the same links
          are reachable from the public footer + the .nav-links above.
       3. #ContentDiv has min-width: 820px !important inline; that
          forces horizontal overflow on a 768px viewport. Override
          with min-width: 0 so the content can flow within the
          viewport. */
    .mct-navbar > div[style*="display: flex"] {
        flex-wrap: wrap;
        justify-content: center;
    }

    .mct-public-sidebar {
        display: none;
    }

    #body-right #ContentDiv {
        min-width: 0 !important;
    }
}

/* Accessibility improvements */
.visually-hidden-focusable:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    clip: auto !important;
}

/* Print styles */
@media print {
    .navbar,
    .mct-navbar,
    .no-print {
        display: none !important;
    }
}
