/**
 * GF Salesforce Lookup Stylesheet
 * Custom CSS implementing high-fidelity glassmorphism, brand colorways, loading skeletons, and fluid responsive layouts.
 */

/* 1. Form Input & Button Wrapper */
.gf-sf-lookup-wrapper {
    display: inline-flex !important;
    width: 100% !important;
    gap: 8px !important;
    align-items: stretch !important;
}

.gf-sf-search-input {
    flex: 1 !important;
    margin-bottom: 0 !important;
}

.gf-sf-search-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #1b5e20 !important; /* EcoRise Green */
    color: #ffffff !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 0 16px !important;
    cursor: pointer !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06) !important;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease !important;
    flex-shrink: 0 !important;
}

.gf-sf-search-btn:hover {
    background-color: #d97706 !important; /* Premium Amber/Gold Hover Accent */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    transform: translateY(-1px) !important;
}

.gf-sf-search-btn:active {
    transform: translateY(1px) !important;
}

.gf-sf-search-btn svg {
    display: block !important;
}

/* 2. Dialog Overlay Modal Base */
#gf-sf-lookup-dialog {
    width: 90vw !important;
    max-width: 750px !important;
    max-height: 80vh !important;
    padding: 0 !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    border-radius: 16px !important;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25) !important;
    background: rgba(255, 255, 255, 0.98) !important;
    overflow: hidden !important;
    color: #1e293b !important;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out !important;
    display: none;
}

/* Glassmorphic backdrop filter */
@supports (backdrop-filter: blur(10px)) {
    #gf-sf-lookup-dialog {
        background: rgba(255, 255, 255, 0.92) !important;
        backdrop-filter: blur(12px) !important;
    }
}

/* Native dialog showing animation classes */
#gf-sf-lookup-dialog[open] {
    display: block !important;
    opacity: 1 !important;
    transform: scale(1) !important;
}

#gf-sf-lookup-dialog::backdrop {
    background-color: rgba(15, 23, 42, 0.45) !important; /* Slate Slate/Dark */
    backdrop-filter: blur(4px) !important;
    opacity: 0;
    transition: opacity 0.2s ease-out !important;
}

#gf-sf-lookup-dialog[open]::backdrop {
    opacity: 1 !important;
}

/* 3. Modal Header */
.gf-sf-dialog-container {
    display: flex !important;
    flex-direction: column !important;
    max-height: 80vh !important;
}

.gf-sf-dialog-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 20px 24px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    background-color: #f8fafc !important;
}

#gf-sf-dialog-title {
    margin: 0 !important;
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    letter-spacing: -0.02em !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", sans-serif !important;
}

.gf-sf-dialog-close {
    background: none !important;
    border: none !important;
    padding: 6px !important;
    cursor: pointer !important;
    color: #64748b !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background-color 0.2s, color 0.2s !important;
}

.gf-sf-dialog-close:hover {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
}

/* 4. Modal Body & Search Input */
.gf-sf-dialog-body {
    padding: 24px !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}

.gf-sf-search-bar-wrapper {
    position: relative !important;
    width: 100% !important;
}

#gf-sf-search-input {
    width: 100% !important;
    height: 46px !important;
    padding: 0 16px !important;
    padding-right: 44px !important;
    font-size: 15px !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 8px !important;
    outline: none !important;
    color: #0f172a !important;
    background-color: #ffffff !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
}

#gf-sf-search-input:focus {
    border-color: #1b5e20 !important; /* EcoRise Green focus */
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.15), inset 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

/* Modern search spinner */
.gf-sf-search-spinner {
    position: absolute !important;
    right: 16px !important;
    top: 50% !important;
    margin-top: -10px !important;
    width: 20px !important;
    height: 20px !important;
    border: 2.5px solid #cbd5e1 !important;
    border-top: 2.5px solid #1b5e20 !important;
    border-radius: 50% !important;
    animation: gfSfSpin 0.75s linear infinite !important;
}

@keyframes gfSfSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 5. Results Table Grid */
.gf-sf-results-container {
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    background-color: #ffffff !important;
    max-height: 380px !important;
    overflow-y: auto !important;
}

.gf-sf-results-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 14px !important;
}

.gf-sf-results-table th,
.gf-sf-results-table td {
    padding: 14px 18px !important;
    text-align: left !important;
    line-height: 1.5 !important;
}

.gf-sf-results-table th {
    background-color: #f8fafc !important;
    color: #475569 !important;
    font-weight: 700 !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    border-bottom: 1.5px solid #e2e8f0 !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 5 !important;
}

.gf-sf-results-table tbody tr {
    border-bottom: 1px solid #f1f5f9 !important;
    transition: background-color 0.15s ease !important;
}

.gf-sf-results-table tbody tr:last-child {
    border-bottom: none !important;
}

.gf-sf-results-table tbody tr:hover {
    background-color: #f8fafc !important;
}

.gf-sf-col-action {
    text-align: right !important;
    width: 100px !important;
}

/* Selection Button styling */
.gf-sf-select-btn {
    background-color: #1b5e20 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 6px 14px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: background-color 0.15s !important;
}

.gf-sf-select-btn:hover {
    background-color: #d97706 !important;
}

/* Empty, Error, and Message States */
.gf-sf-table-empty,
.gf-sf-table-error {
    text-align: center !important;
    padding: 40px 20px !important;
    color: #64748b !important;
    font-size: 14px !important;
}

/* Shimmering Skeleton Loaders */
.gf-sf-skeleton-loader {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    padding: 20px 10px !important;
}

.gf-sf-skeleton-line {
    height: 14px !important;
    width: 100% !important;
    border-radius: 4px !important;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%) !important;
    background-size: 200% 100% !important;
    animation: gfSfSkeletonShimmer 1.5s infinite linear !important;
}

.gf-sf-skeleton-line:nth-child(2) {
    width: 85% !important;
}

.gf-sf-skeleton-line:nth-child(3) {
    width: 60% !important;
}

@keyframes gfSfSkeletonShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* 6. "Other" Option Footer Trigger */
.gf-sf-other-footer {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 16px 24px !important;
    background-color: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
    gap: 16px !important;
}

.gf-sf-other-prompt {
    font-size: 13.5px !important;
    color: #475569 !important;
    font-weight: 500 !important;
}

.gf-sf-other-toggle-btn {
    background: none !important;
    border: 1.5px solid #d97706 !important; /* Premium Amber Gold outline */
    color: #d97706 !important;
    border-radius: 6px !important;
    padding: 8px 16px !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
}

.gf-sf-other-toggle-btn:hover {
    background-color: rgba(217, 119, 6, 0.06) !important;
    transform: translateY(-0.5px) !important;
}

/* 7. "Other" Custom Input Screen */
#gf-sf-other-input-container {
    padding: 24px 8px !important;
    width: 100% !important;
}

.gf-sf-other-field-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    max-width: 440px !important;
    margin: 0 auto !important;
    width: 100% !important;
}

.gf-sf-other-label {
    font-size: 13.5px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
}

#gf-sf-other-name-input {
    width: 100% !important;
    height: 46px !important;
    padding: 0 16px !important;
    font-size: 15px !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 8px !important;
    outline: none !important;
    color: #0f172a !important;
    background-color: #ffffff !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.2s ease !important;
}

#gf-sf-other-name-input:focus {
    border-color: #d97706 !important;
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15), inset 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

#gf-sf-other-name-input.gf-sf-input-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15), inset 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.gf-sf-other-actions {
    display: flex !important;
    gap: 12px !important;
    justify-content: flex-end !important;
    margin-top: 8px !important;
}

.gf-sf-other-cancel-btn {
    background: none !important;
    border: 1px solid #cbd5e1 !important;
    color: #475569 !important;
    padding: 8px 18px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
}

.gf-sf-other-cancel-btn:hover {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

.gf-sf-other-confirm-btn {
    background-color: #1b5e20 !important;
    border: none !important;
    color: #ffffff !important;
    padding: 8px 22px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.15s ease !important;
}

.gf-sf-other-confirm-btn:hover {
    background-color: #d97706 !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
}

/* 8. Mobile Responsiveness */
@media screen and (max-width: 640px) {
    #gf-sf-lookup-dialog {
        width: 95vw !important;
        max-height: 90vh !important;
        border-radius: 12px !important;
    }
    
    .gf-sf-dialog-header,
    .gf-sf-dialog-body {
        padding: 16px !important;
    }

    .gf-sf-results-table th,
    .gf-sf-results-table td {
        padding: 10px 12px !important;
        font-size: 13px !important;
    }

    .gf-sf-results-table th {
        font-size: 10px !important;
    }

    .gf-sf-select-btn {
        padding: 5px 10px !important;
        font-size: 11px !important;
    }

    .gf-sf-other-footer {
        flex-direction: column !important;
        align-items: stretch !important;
        text-align: center !important;
        gap: 12px !important;
        padding: 16px !important;
    }

    .gf-sf-other-toggle-btn {
        width: 100% !important;
        text-align: center !important;
    }
}
