.connection-panel {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 10px 15px -3px rgba(0, 0, 0, 0.025);
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}


.input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    position: relative;
}

.input-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-left: 2.5rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    background: var(--input-background);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.input-group i {
    position: absolute;
    left: 220px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    opacity: 0.7;
    font-size: 0.9rem;
}

.input-group input:first-child {
    max-width: 200px;
}

.input-group input:last-child {
    flex: 1;
}

#connectionName {
    width: 200px;
    padding: 0.75rem 1rem;
    background: var(--input-background);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.925rem;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

#esUrl {
    flex: 1;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background: var(--input-background);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.925rem;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

#esUrl:hover {
    border-color: rgba(99, 102, 241, 0.4);
}

#esUrl:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#esUrl::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.button-group {
    display: flex;
    gap: 0.5rem;
}

.button-group button {
    padding: 0.75rem 1.25rem;
    font-size: 0.925rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.button-group button i {
    font-size: 1rem;
    opacity: 0.9;
}

.button-group button:hover {
}

.button-group button:active {
    transform: translateY(0);
}

#testBtn {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    border: 1px solid transparent;
}

#testBtn:hover {
    background: rgba(99, 102, 241, 0.15);
}

#connectBtn {
    background: var(--primary-color);
    color: white;
    border: 1px solid transparent;
}

#connectBtn:hover {
    background: var(--primary-hover);
}

#disconnectBtn {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid transparent;
}

#disconnectBtn:hover {
    background: rgba(239, 68, 68, 0.15);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid rgba(229, 231, 235, 0.8);
    border-radius: var(--radius-md);
    font-size: 0.925rem;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.form-group input:hover {
    border-color: rgba(99, 102, 241, 0.4);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.form-group input[type="number"]::-webkit-outer-spin-button,
.form-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#createIndexModal .modal-body {
    padding: 1.5rem;
}

#createIndexModal .form-group:last-child {
    margin-bottom: 0;
}

#createIndexModal input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

#createIndexModal .modal-footer {
    padding: 1.25rem;
    background: var(--modal-background);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

#createIndexModal .modal-footer button {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}


#createIndexModal .modal-footer button:active {
    transform: translateY(0);
}

#createIndexModal .modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid rgba(229, 231, 235, 0.4);
}

#createIndexModal .modal-header h3 {
    font-size: var(--text-lg);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#createIndexModal .modal-header h3 i {
    color: var(--primary-color);
    opacity: 0.9;
}

.mapping-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.mapping-tab {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-primary);
    background: var(--input-background);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.mapping-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.code-editor {
    width: 100%;
    min-height: 300px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 1rem;
    background: var(--input-background);
    color: var(--input-text);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    resize: vertical;
}

.code-editor:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--input-focus-ring);
}

.visual-mapping-editor {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--modal-background);
    padding: 1rem;
    border-radius: 8px;
}

.mapping-fields {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.mapping-field {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: var(--input-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.field-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.field-name {
    font-weight: 500;
    color: var(--text-primary);
}

.field-type {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    background: var(--info-bg);
    border-radius: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.add-field-form {
    padding: 0.75rem;
    background: var(--input-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.add-field-form .form-group {
    margin-bottom: 0;
}

.add-field-form input,
.add-field-form select {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: var(--input-background);
    color: var(--input-text);
    border: 1px solid var(--border-color);
}

.add-field-form select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.add-field-form button {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: var(--input-background);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.add-field-form button:hover {
    background: var(--button-hover-bg);
    border-color: var(--button-hover-border);
}

.remove-field {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.25rem;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.remove-field:hover {
    background: var(--error-bg);
    color: var(--error-color);
    opacity: 1;
}

.field-draft-badge {
    font-size: 0.7rem;
    color: var(--primary-color);
    background: var(--info-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    font-weight: 500;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.document-fields {
    display: grid;
    gap: 1.25rem;
    padding: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}

.document-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid rgba(229, 231, 235, 0.8);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.document-field:hover {
    background: white;
    border-color: #e2e8f0;
}

.document-field label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.field-type-badge {
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    font-weight: 500;
}

.document-field input,
.document-field select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid rgba(229, 231, 235, 0.8);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--input-text);
    background: var(--input-background);
    transition: all 0.2s ease;
}

.document-field input:hover,
.document-field select:hover {
    border-color: #94a3b8;
}

.document-field input:focus,
.document-field select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.document-field input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.document-field input[type="number"]::-webkit-outer-spin-button,
.document-field input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.document-field input[type="datetime-local"] {
    padding: 0.5rem;
}

.document-id-field {
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid rgba(229, 231, 235, 0.8);
    border-radius: 8px;
}

.document-id-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.document-id-field input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid rgba(229, 231, 235, 0.8);
    border-radius: 6px;
    font-size: 0.875rem;
}

.refresh-control {
    min-width: 120px;
    position: relative;
    z-index: 2;
    margin-right: -0.5rem;
}

.refresh-control .connection-dropdown {
    position: relative;
    z-index: 1001;
}

.refresh-control .connection-select-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--input-background);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.925rem;
    transition: all 0.2s ease;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    gap: 0.5rem;
}

.refresh-control .connection-select-btn:hover {
    border-color: var(--primary-color);
    background: var(--button-hover-bg);
}

.refresh-control .connection-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 1002;
    backdrop-filter: blur(8px);
    max-height: 300px;
    overflow-y: auto;
}

.refresh-control .connection-dropdown-menu.show {
    display: block;
    animation: dropdownFadeIn 0.2s ease;
}

.refresh-control .connection-list {
    position: relative;
}

.refresh-control .connection-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-panel);
    color: var(--text-primary);
}

.refresh-control .connection-item:last-child {
    border-bottom: none;
}

.refresh-control .connection-item:hover {
    background: var(--button-hover-bg);
}

.saved-connections {
    min-width: 200px;
    position: relative;
    z-index: 2;
    margin-left: -0.5rem;
}

.connection-dropdown {
    position: relative;
    z-index: 1001;
}

.connection-select-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--input-background);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.925rem;
    transition: all 0.2s ease;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    gap: 0.5rem;
}

.connection-select-btn:hover {
    border-color: var(--primary-color);
    background: var(--button-hover-bg);
}

.connection-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 1002;
    backdrop-filter: blur(8px);
    max-height: 300px;
    overflow-y: auto;
}

.connection-dropdown-menu.show {
    display: block;
    animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.connection-list {
    position: relative;
}

.connection-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-panel);
    color: var(--text-primary);
}

.connection-item:last-child {
    border-bottom: none;
}

.connection-item:hover {
    background: var(--button-hover-bg);
}

.connection-item-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.connection-item:hover .connection-item-actions {
    opacity: 1;
}

.connection-action-btn {
    padding: 0.25rem;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
}

.connection-action-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.connection-action-btn.edit:hover {
    color: var(--primary-color);
}

.connection-action-btn.delete:hover {
    color: var(--error-color);
}

.connection-dropdown-menu::-webkit-scrollbar {
    width: 8px;
}

.connection-dropdown-menu::-webkit-scrollbar-track {
    background: var(--background-color);
    border-radius: 4px;
}

.connection-dropdown-menu::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.connection-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.connection-form select,
.connection-form input {
    background: var(--input-background);
    color: var(--input-text);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    width: 100%;
    transition: all 0.2s ease;
}

.connection-form select {
    appearance: none;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    cursor: pointer;
}

.connection-form select option {
    background: var(--input-background);
    color: var(--input-text);
    padding: 0.5rem;
}

.connection-form select:hover,
.connection-form input:hover {
    border-color: var(--button-hover-border);
}

.connection-form select:focus,
.connection-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--input-focus-ring);
}

.connection-form button {
    background: var(--button-bg);
    color: var(--button-text);
    border: 1px solid var(--button-border);
    border-radius: 6px;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.connection-form button:hover {
    background: var(--button-hover-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.mapping-field select,
.mapping-field input {
    background: var(--input-background);
    color: var(--input-text);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 4px;
}

.mapping-field select:focus,
.mapping-field input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--input-focus-ring);
}

.mapping-field-actions {
    display: flex;
    gap: 0.5rem;
}

.mapping-field-actions button {
    padding: 0.5rem;
    border-radius: 4px;
    background: var(--input-background);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.mapping-field-actions button:hover {
    background: var(--button-hover-bg);
    border-color: var(--button-hover-border);
}

.mapping-field-actions button.delete-field {
    color: var(--error-color);
}

.mapping-field-actions button.delete-field:hover {
    background: var(--error-bg);
    border-color: var(--error-color);
}

.form-select {
    appearance: none;
    background-color: var(--input-background);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    font-size: var(--text-sm);
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1em;
}

.form-select:hover {
    border-color: rgba(99, 102, 241, 0.4);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-select option {
    background-color: var(--background);
    color: var(--text-primary);
    padding: 0.5rem;
}

.auth-group {
    margin-top: 1rem;
    width: 100%;
    padding: 1rem;
    background: var(--input-background);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.auth-header {
    margin-bottom: 0.75rem;
}

.auth-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.auth-optional {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-left: 0.5rem;
    font-weight: normal;
}

.auth-inputs {
    display: flex;
    gap: 1rem;
    max-width: 600px;
}

.password-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    width: 100%;
    padding-right: 40px;
}

.password-toggle {
    background: none;
    border: none;
    padding: 0;
    width: 40px;
    color: var(--text-secondary);
    opacity: 0.7;
    cursor: pointer;
    transition: all 0.2s ease;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.password-toggle:hover {
    opacity: 0.9;
}

.password-toggle.visible i::before {
    content: "\f070";
}

.auth-inputs input {
    flex: 1;
    padding: 0.6rem 1rem;
    background: var(--input-background);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.auth-inputs input:hover {
    border-color: rgba(99, 102, 241, 0.4);
}

.auth-inputs input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#updateMappingModal .modal-header h3 .index-name {
    color: var(--primary-color);
    font-weight: 600;
    margin-left: 0.25rem;
}

#saveConnectionBtn {
    background-color: #4f46e5;
    color: white !important;
    border: none;
    border-radius: 8px;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#saveConnectionBtn:hover {
    background-color: #4338ca; 
}

[data-theme="light"] #saveConnectionBtn {
    background-color: #f8fafc; 
    color: #4f46e5 !important; 
    border: 1px solid #4f46e5;
}

[data-theme="light"] #saveConnectionBtn:hover {
    background-color: #eef2ff; 
    color: #4338ca !important;
    border-color: #4338ca;
}

[data-theme="dark"] #saveConnectionBtn {
    background-color: #4b5563; 
    color: #e2e8f0 !important; 
    border: 1px solid #6b7280; 
}

[data-theme="dark"] #saveConnectionBtn:hover {
    background-color: #374151; 
    color: white !important;
    border-color: #9ca3af;
}

#saveConnectionBtn:active {
    transform: translateY(0);
}

#saveConnectionBtn i {
    font-size: 0.875rem;
} 