/* Custom Styles for MFSA Search Forms */

:root {
    /* MFSA Official Brand Colors */
    --mfsa-brand-color: #00685e; 
    --mfsa-brand-hover: #004d45; 
    --mfsa-brand-shadow: rgba(0, 104, 94, 0.2);
    --mfsa-light-grey: #f8f9fa;
    --mfsa-border-color: #dee2e6;
    --mfsa-input-border: #dcdcdc;
    --mfsa-text-main: #333333;
    --mfsa-text-muted: #444444;
    --mfsa-focus-ring: #003d37; 
}

/* =========================================================
   ACCESSIBILITY UTILITIES (WCAG AA)
   ========================================================= */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Universal Keyboard Navigation Focus States */
.msc-search-card *:focus {
    outline: 3px solid var(--mfsa-focus-ring) !important;
    outline-offset: 2px !important;
    border-radius: 2px;
}

/* High-Contrast Focus for Buttons and Interactive Grid (White inner ring, Dark outer ring) */
.btn-browse-header:focus,
.btn-search:focus,
.msc-letter-item:focus {
    outline: 3px solid #ffffff !important;
    outline-offset: 1px !important;
    box-shadow: 0 0 0 5px var(--mfsa-focus-ring) !important;
}

/* =========================================================
   FORM STYLES
   ========================================================= */

/* 1. Main Container */
.msc-search-card {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #ffffff;
    border: 1px solid var(--mfsa-border-color);
    border-radius: 8px;
    max-width: 850px;
    margin: 40px auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    overflow: hidden;
}

/* 2. Header & Labels */
.msc-search-header {
    background-color: var(--mfsa-brand-color);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

h2.msc-header-label, 
.msc-header-label {
    color: #ffffff !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 0.5px;
    margin: 0 !important;
}

.btn-browse-header {
    background: #ffffff !important;
    color: var(--mfsa-brand-color) !important;
    border: none;
    padding: 6px 15px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

/* FIXED: Forcing the text color so the theme doesn't turn it white */
.btn-browse-header:hover {
    background: var(--mfsa-light-grey) !important;
    color: var(--mfsa-brand-color) !important; 
}

/* 3. Search Body & Form Elements */
.msc-search-body {
    padding: 35px 45px;
    overflow: visible !important;
}

.msc-date-label,
.msc-search-body label {
    margin-top: 10px;
    margin-bottom: 8px;
    color: var(--mfsa-text-muted);
    font-size: 14px;
    font-weight: 600;
    display: block;
}

.msc-form-group {
    margin-bottom: 20px;
}

/* FIXED: Changed from padding to height:48px to prevent text cutoff in dropdowns */
.msc-form-group input, 
.msc-date-input input,
.msc-search-body select {
    width: 100%;
    height: 48px; 
    padding: 0 15px; 
    border: 1.5px solid var(--mfsa-input-border);
    border-radius: 6px;
    font-size: 16px;
    color: var(--mfsa-text-main);
    background-color: #ffffff;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.msc-search-body select {
    appearance: auto;
    cursor: pointer;
}

.msc-form-group input:focus, 
.msc-date-input input:focus,
.msc-search-body select:focus {
    border-color: var(--mfsa-brand-color) !important;
    box-shadow: 0 0 0 3px var(--mfsa-brand-shadow) !important;
}

.msc-form-group input::placeholder {
    color: #999;
}

.msc-divider {
    border: 0;
    border-top: 1px solid #eee;
    margin: 30px 0;
}

/* 4. Browse Section (Alphabet & Years) */
.msc-browse-section {
    margin-bottom: 30px;
}

.msc-alphabet-wrapper {
    padding: 10px 0 20px 0;
}

.msc-letter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.msc-letter-item {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 42px; 
    height: 42px; 
    background: var(--mfsa-light-grey);
    border: 1px solid var(--mfsa-border-color);
    border-radius: 6px;
    text-decoration: none !important;
    color: var(--mfsa-brand-color) !important;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s ease;
}

.msc-letter-item:hover {
    background-color: var(--mfsa-brand-color) !important;
    color: #ffffff !important;
    border-color: var(--mfsa-brand-color) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--mfsa-brand-shadow);
}

.msc-num-item {
    width: auto;
    min-width: 55px; 
    padding: 0 15px;
}

.msc-year-row {
    margin-top: 5px;
}

.msc-year-browse {
    max-width: 200px;
}

/* 5. Date Row Layout */
.msc-date-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.msc-date-input {
    flex: 1;
}

.msc-date-separator {
    color: var(--mfsa-text-muted);
    font-weight: normal;
}

/* 6. Buttons & Actions */
.msc-action-row {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    border-top: 1px solid #eee;
    padding-top: 25px;
}

.btn-reset {
    background-color: #f4f4f4 !important;
    color: #333333 !important;
    padding: 10px 25px;
    border-radius: 4px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

/* FIXED: Forcing the text color so the theme doesn't turn it white */
.btn-reset:hover {
    background-color: #e6e8eb !important;
    color: #333333 !important;
}

.btn-search {
    background-color: var(--mfsa-brand-color) !important;
    color: #ffffff !important;
    padding: 10px 30px;
    border-radius: 6px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-search:hover {
    background-color: var(--mfsa-brand-hover) !important;
    color: #ffffff !important;
}

/* 7. Mobile Responsiveness */
@media (max-width: 700px) {
    .msc-search-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    .msc-date-row {
        flex-direction: column;
    }
    .msc-search-body {
        padding: 20px;
    }
}