/**
 * Icon Picker for Gravity Forms - Frontend Styles
 */

.ginput_container_icon_picker {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ginput_container_icon_picker .fa-solid,
.ginput_container_icon_picker .fa-regular,
.ginput_container_icon_picker .fa-brands,
.ginput_container_icon_picker .fa {
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome", "Font Awesome 6 Brands", "Font Awesome 5 Brands" !important;
    font-style: normal;
    line-height: 1;
}

.ginput_container_icon_picker .fa-solid,
.ginput_container_icon_picker .fa {
    font-weight: 900 !important;
}

.ginput_container_icon_picker .fa-regular {
    font-weight: 400 !important;
}

.ginput_container_icon_picker .fa-brands {
    font-family: "Font Awesome 6 Brands", "Font Awesome 5 Brands", "FontAwesome" !important;
    font-weight: 400 !important;
}

.gfip-picker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.gfip-picker:hover {
    border-color: #2271b1;
}

.gfip-picker:focus,
.gfip-picker:focus-within {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.gfip-picker[disabled] {
    background: #f0f0f1;
    cursor: not-allowed;
    opacity: 0.7;
}

.gfip-picker-display {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.gfip-placeholder {
    color: #757575;
    font-style: italic;
}

.gfip-selected-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    line-height: 1;
}

.gfip-selected-label {
    font-size: 14px;
    color: inherit;
}

.gfip-picker-button {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #787c82;
    transition: color 0.2s;
}

.gfip-picker-button:hover {
    color: #2271b1;
}

.gfip-clear-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #cc1818;
    font-size: 14px;
    opacity: 0.7;
    transition: color 0.2s, opacity 0.2s, background 0.2s;
}

.gfip-clear-button:hover {
    opacity: 1;
    color: #a61212;
}

.gfip-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
}

.gfip-modal.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gfip-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
}

body.gfip-modal-open {
    overflow: hidden;
}

.gfip-modal-content {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gfip-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f6f7f7;
}

.gfip-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
}

.gfip-modal-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #787c82;
    font-size: 18px;
    line-height: 1;
    transition: color 0.2s;
}

.gfip-modal-close:hover {
    color: #cc1818;
}

.gfip-modal-search {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.gfip-search-wrapper {
    position: relative;
}

.gfip-search-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #787c82;
}

#gfip-search {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#gfip-search:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.gfip-modal-tabs {
    display: flex;
    padding: 0 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f6f7f7;
}

.gfip-tab {
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #50575e;
    transition: color 0.2s, border-color 0.2s;
    margin-bottom: -1px;
}

.gfip-tab:hover {
    color: #2271b1;
}

.gfip-tab.active {
    color: #2271b1;
    border-bottom-color: #2271b1;
}

.gfip-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    min-height: 300px;
}

.gfip-icons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.gfip-icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 70px;
}

.gfip-icon-item:hover {
    border-color: #2271b1;
    background: #f0f6fc;
}

.gfip-icon-item:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.3);
    outline: none;
}

.gfip-icon-item.selected {
    border-color: #2271b1;
    background: #f0f6fc;
}

.gfip-icon-item i {
    font-size: 24px;
    margin-bottom: 6px;
    color: inherit;
}

.gfip-icon-name {
    font-size: 10px;
    text-align: center;
    color: #50575e;
    word-break: break-word;
    line-height: 1.2;
    max-height: 2.4em;
    overflow: hidden;
}

.gfip-loading {
    display: none;
    text-align: center;
    padding: 40px;
    color: #787c82;
    font-size: 24px;
}

.gfip-no-results {
    display: none;
    text-align: center;
    padding: 40px;
    color: #787c82;
    font-size: 14px;
}

.gfip-icon-size-16 { font-size: 16px; }
.gfip-icon-size-24 { font-size: 24px; }
.gfip-icon-size-32 { font-size: 32px; }
.gfip-icon-size-48 { font-size: 48px; }
.gfip-icon-size-64 { font-size: 64px; }
.gfip-icon-size-96 { font-size: 96px; }
.gfip-icon-size-128 { font-size: 128px; }

.gfield_icon_picker_value {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.gfield_icon_picker_value i {
    font-size: 32px;
}

@media (max-width: 600px) {
    .gfip-modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .gfip-icons-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }

    .gfip-icon-item {
        padding: 10px 6px;
        min-height: 60px;
    }

    .gfip-icon-item i {
        font-size: 20px;
    }

    .gfip-icon-name {
        font-size: 9px;
    }

    .gfip-tab {
        padding: 10px 12px;
        font-size: 12px;
    }
}
