/* ==========================================================================
   CoreLink — Frontend Styles
   1. Utilities
   2. Layout & Column Collapse
   3. Loading Overlay
   4. Form Controls
   5. Form Groups & Icons
   6. Validation States
   7. Select2 Overrides
   8. Switch / Toggle
   9. Alerts
   10. Buttons & Close
   11. File Upload
   12. Tooltips
   13. Small Text
   ========================================================================== */

/* ==========================================================================
   1. Utilities
   ========================================================================== */

.d-none { display: none !important; }
.d-inline { display: inline !important; }
.text-danger { color: red; }
.text-red { color: red; }
.mb-15 { margin-bottom: 15px; }

/* ==========================================================================
   2. Layout, Spacing & Column Collapse
   ========================================================================== */

.corelink-widget-collapsed,
.corelink-column-collapsed {
    display: none !important;
}

/* --- Form field spacing --- */

label + .form-group,
label + .corelink-boolean,
label + .corelink-optionset,
label + .corelink-lookup {
    margin-top: 6px;
}

.form-group,
.corelink-boolean,
.corelink-optionset,
.corelink-lookup {
    margin-bottom: 10px;
}

/* ==========================================================================
   3. Loading Overlay
   ========================================================================== */

#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: opacity 0.5s ease-out;
    opacity: 0;
}

/* ==========================================================================
   4. Form Controls
   ========================================================================== */

.corelink-form-control,
input[type=file].corelink-form-control {
    border: 1px solid #e1e8ee !important;
    box-shadow: none;
    border-radius: 3px;
    transition: all 0.2s ease-in-out;
    font-weight: 300;
    margin: 0 !important;
    opacity: 1 !important;
}

.corelink-form-control-lg,
.input-group-lg > .corelink-form-control,
.input-group-lg > .input-group-addon,
.form-group .select2-container--default .select2-selection--single,
input[type=file].corelink-form-control-lg {
    opacity: 1 !important;
    border: 2px solid #e1e8ee !important;
    border-radius: 5px !important;
    color: #43484d !important;
    font-size: 14px;
    height: 50px !important;
    padding: 15px;
    width: 100% !important;
}

/* Select needs its own padding — the global padding: 35px from wp-custom-css
   collapses the text area (35+35=70px padding in a 74px select = no room for text).
   element+class specificity wins over class-only, even with !important. */
select.corelink-form-control-lg {
    padding: 0 20px !important;
    height: 50px !important;
    line-height: normal !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23ffffff' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 16px center !important;
    cursor: pointer !important;
}

.corelink-form-control-lg[type="textarea"] {
    height: auto !important;
    resize: none !important;
}

.corelink-form-control-lg:focus,
.corelink-form-control-lg:focus-visible,
.input-group-lg > .corelink-form-control:focus,
.input-group-lg > .corelink-form-control:focus-visible,
.input-group-lg > .input-group-addon:focus,
.input-group-lg > .input-group-addon:focus-visible {
    border-color: #00ABC9 !important;
    outline: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   5. Form Groups & Icons
   ========================================================================== */

.form-group {
    position: relative;
    margin: 0;
}

.form-group.has-icon input {
    padding-left: 60px;
}

.form-group.has-icon select {
    padding: 12px 15px 12px 57px !important;
}

.form-group.has-icon .icon::after {
    content: "";
    height: 26px;
    width: 1px;
    border-right: solid 1px #e1e8ee;
    position: absolute;
    top: 40%;
    left: 30px;
    transform: translateY(-50%);
}

.icon {
    width: 18px;
    position: absolute;
    left: 14px;
    top: 15px;
    z-index: 1;
}

.icon svg {
    fill: #95A0AA;
}

/* ==========================================================================
   6. Validation States
   ========================================================================== */

.corelink-form-control-lg.is-invalid,
.corelink-form-control-lg.is-invalid + .select2.select2-container .select2-selection.select2-selection--single,
input[type=file].corelink-form-control-lg.is-invalid,
input[type=file].corelink-form-control.is-invalid {
    border-color: #ed5564 !important;
}

/* ==========================================================================
   7. Select2 Overrides
   ========================================================================== */

.form-group.has-icon .select2 {
    width: 100% !important;
}

.form-group .select2-container .select2-selection--single {
    padding: 9px !important;
    font-size: 14px;
}

.form-group.has-icon .select2-container .select2-selection--single {
    padding: 9px 9px 9px 50px !important;
}

.form-group .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 50px;
}

/* ==========================================================================
   8. Switch / Toggle
   ========================================================================== */

.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 23px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.slider::before {
    position: absolute;
    content: "";
    height: 15px;
    width: 15px;
    left: 4px;
    bottom: 4px;
    background-color: #fff;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider::before {
    transform: translateX(19px);
}

.slider:active::before {
    width: 28px;
}

/* ==========================================================================
   9. Alerts
   ========================================================================== */

.alert {
    position: relative;
    padding: 1rem 2.5rem 1rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
}

.alert-success { color: #0f5132; background-color: #d1e7dd; border-color: #badbcc; }
.alert-danger  { color: #842029; background-color: #f8d7da; border-color: #f5c2c7; }
.alert-warning { color: #664d03; background-color: #fff3cd; border-color: #ffecb5; }
.alert-primary { color: #084298; background-color: #cfe2ff; border-color: #b6d4fe; }
.alert-secondary { color: #41464b; background-color: #e2e3e5; border-color: #d3d6d8; }
.alert-info    { color: #055160; background-color: #cff4fc; border-color: #b6effb; }

.corelink-fade {
    transition: opacity 0.15s linear;
}

/* ==========================================================================
   10. Buttons & Close
   ========================================================================== */

.corelink-btn:hover {
    cursor: pointer;
}

.corelink-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #000;
    height: auto !important;
}

.corelink-close:hover {
    color: #721c24;
}

/* ==========================================================================
   11. File Upload
   ========================================================================== */

.corelink-file {
    padding-top: 12.5px !important;
    background: white;
    text-indent: -1000px;
}

.custom-file-label {
    display: inline-block;
    padding: 2px 12px;
    cursor: pointer;
    background-color: #0073aa;
    color: white;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    transition: background-color 0.3s ease;
}

.custom-file-label:hover {
    background-color: #005b8a;
}

.custom-file-parts {
    position: absolute;
    left: 62px;
    top: 11px;
}

/* ==========================================================================
   12. Tooltips
   ========================================================================== */

.svg-icon {
    width: 20px;
    height: 20px;
    position: relative;
    top: 4px;
    border-radius: 100%;
    overflow: hidden;
}

.corelink-tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.corelink-tooltip .tooltiptext {
    visibility: hidden;
    text-align: center;
    border-radius: 5px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
}

.corelink-tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* ==========================================================================
   13. Small Text
   ========================================================================== */

small.corelink-small {
    color: #676767;
    font-size: 12px;
    line-height: 4px !important;
}
