
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0);
    z-index: 1001;
    -webkit-backdrop-filter: blur(0px);
    backdrop-filter: blur(0px);
    transition: background-color 0.3s ease, -webkit-backdrop-filter 0.3s ease, backdrop-filter 0.3s ease;
}

.modal.show {
    background-color: rgba(0, 0, 0, 0.4);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}


@supports not (backdrop-filter: blur(5px)) {
    .modal {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
    .modal.show {
        background-color: rgba(0, 0, 0, 0.6);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
   
    transform: translateX(-50%) translateY(-50%) translateY(50px);
    background: rgba(255, 255, 255, 0.027);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(255, 255, 255, 0.08),
        inset 0 0 42px 21px rgba(255, 255, 255, 0.021);
    padding: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    color: #fff;
    font-family: 'InfraRegular', monospace;
    opacity: 0;
   
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1), opacity 0.3s ease;
   
    will-change: transform, opacity;
}

.modal.show .modal-content {
    transform: translateX(-50%) translateY(-50%);
    opacity: 1;
}

.close-modal {
    color: var(--secondary-text-color);
    float: right;
    background: none;
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--primary-text-color);
    text-decoration: none;
    cursor: pointer;
}

.model-metadata {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 50px;
    margin-bottom: 20px;
}

.model-metadata p {
    margin: 5px 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.model-features {
    margin-top: 20px;
}

.features-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.model-features h3 {
    margin: 0;
    font-size: 1.1rem;
}

#toggle-feature-names {
    backdrop-filter: none;
}

#feature-list {
    list-style-type: none;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 10px;
}

#feature-list li {
    margin: 3px 0;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 0.9rem;
    word-break: break-word;
}


.modal-content::-webkit-scrollbar {
    width: 1px;
}

.modal-content::-webkit-scrollbar-thumb {
    background-color: #ffffff3f;
    border-radius: 10px;
}

#feature-list::-webkit-scrollbar {
    width: 1px;
}

#feature-list::-webkit-scrollbar-thumb {
    background-color: #ffffff3f;
    border-radius: 10px;
}


@-moz-document url-prefix() {
    .modal-content {
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
    }
    
    #feature-list {
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
    }
}


@media (max-width: 768px) {
    .modal-content {
        width: 80%;
        max-height: 75vh;
        padding: 15px;
    }
    
    .model-metadata {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    
    .model-metadata p {
        font-size: 0.8rem;
    }
    
    #feature-list {
        max-height: 150px;
    }
    
    #feature-list li {
        font-size: 0.75rem;
    }
}


.model-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    z-index: 9999;
    -webkit-backdrop-filter: blur(0px);
    backdrop-filter: blur(0px);
    transition: background-color 0.3s ease, -webkit-backdrop-filter 0.3s ease, backdrop-filter 0.3s ease;
}

.model-modal.show {
    background-color: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}


@supports not (backdrop-filter: blur(5px)) {
    .model-modal {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
    .model-modal.show {
        background-color: rgba(0, 0, 0, 0.7);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

.model-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translateX(-50%) translateY(-50%) translateY(50px);
    opacity: 0;
    background: rgba(255, 255, 255, 0.027);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(255, 255, 255, 0.08),
        inset 0 0 42px 21px rgba(255, 255, 255, 0.021);
    padding: 20px;
    width: 85%;
    max-width: 500px;
    max-height: 75vh;
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1), opacity 0.3s ease;
    will-change: transform, opacity;
}

.model-info-loaded {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 4px;
}

.model-switch {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 8px 0 12px 0;
    color: #fff;
    font-family: 'InfraRegular', monospace;   
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1), opacity 0.3s ease;
    will-change: transform, opacity;
    transform: translateY(-8px);
    opacity: 0;
}

.model-modal.show .model-modal-content {
    transform: translateX(-50%) translateY(-50%);
    opacity: 1;
}

.model-modal.show .model-switch {
    transform: translateY(0);
    opacity: 1;
}

.model-modal h2 {
    margin: 0 0 5px 0;
    font-family: 'InfraBold', monospace;
    font-size: 24px;
    text-align: center;
    color: #fff;
}

.model-modal-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.model-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.model-modal-close:hover {
    color: rgba(255, 255, 255, 1);
}

.model-info-section {
    margin-bottom: 15px;
}

.model-info-section p {
    margin: 5px 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    line-height: 1.4;
}

.model-info-section strong {
    color: #fff;
    font-weight: 600;
}

.model-features {
    margin-top: 15px;
}

.model-features h3 {
    margin: 0 0 10px 0;
    color: #fff;
    font-family: 'InfraMedium', monospace;
    font-size: 16px;
}

.model-features ul {
    list-style-type: none;
    margin: 10px 0;
    padding: 0;
}

.model-features li {
    margin: 4px 0;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.3;
    font-size: 12px;
}


.model-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'InfraRegular', monospace;
    font-size: 14px;
}

.model-loading::before {
    content: "⚡";
    animation: pulse 1.5s infinite;
    margin-right: 8px;
    color: #44ffb2;
}


.model-error {
    padding: 15px;
    background: rgba(255, 100, 100, 0.1);
    border: 1px solid rgba(255, 100, 100, 0.3);
    border-radius: 8px;
    color: rgba(255, 100, 100, 0.8);
    font-family: 'InfraRegular', monospace;
    font-size: 14px;
    text-align: center;
    margin: 10px 0;
}


@media (max-width: 600px) {
    .model-modal-content {
        width: 90vw !important;
        max-width: none !important;
        height: auto !important;
        max-height: 75vh !important;
        padding: 15px !important;
        overflow-y: auto;
    }
    
    .model-modal h2 {
        font-size: 1.2rem;
    }
    
    .model-features h3 {
        font-size: 14px;
    }
    
    .model-info-section p {
        font-size: 11px;
    }
    
    .model-features li {
        font-size: 10px;
    }
    
    .model-modal-close {
        top: 10px;
        right: 15px;
        font-size: 20px;
    }
}


.model-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}


@media (max-width: 480px) {
    .model-info-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .model-modal-content {
        width: 80vw !important;
        padding: 12px !important;
        max-height: 75vh !important;
    }
    
    .model-modal h2 {
        font-size: 1.2rem;
        }
    
    .model-features h3 {
        font-size: 13px;
        margin-bottom: 8px;
    }
    
    .model-info-section p {
        font-size: 10px;
        margin: 3px 0;

    }
    
    .model-features li {
        font-size: 9px;
        margin: 2px 0;
    }
    
    #toggle-feature-names {
        font-size: 10px !important;
        padding: 4px 8px !important;
    }
    
    .model-toggle-button {
        font-size: 10px !important;
        padding: 4px 8px !important;
    }
    
    .model-features-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .model-features-header h3 {
        font-size: 13px;
    }
}


.model-info-grid p {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 5px 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.4;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 5px 0;
}

.model-info-grid strong {
    color: #fff;
    font-weight: 600;
    flex-shrink: 0;
}


.model-features-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.model-features-header h3 {
    margin: 0;
    color: #fff;
    font-family: 'InfraMedium', monospace;
    font-size: 16px;
}


.model-toggle-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-family: 'InfraRegular', monospace;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.model-toggle-button.selected {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.model-modal-header .model-switch {
    display: flex;
    gap: 6px;
    margin-left: 4px; /* move a bit to the left near the title */
}

.model-toggle-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.model-toggle-button:active {
    background: rgba(68, 255, 178, 0.2);
    border-color: rgba(68, 255, 178, 0.4);
}


.settings-modal-content {
    width: 90%;
    max-width: 650px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
}

.settings-modal-header {
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 8px;
    flex-shrink: 0;
}

.settings-modal-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: #fff;
    font-family: 'InfraRegular', monospace;
}

#settings-modal-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    margin-right: -5px;
}


#settings-modal-content::-webkit-scrollbar {
    width: 1px;
}

#settings-modal-content::-webkit-scrollbar-thumb {
    background-color: #ffffff3f;
    border-radius: 10px;
}

#settings-modal-content::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}


#settings-modal-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.settings-section {
    margin-bottom: 25px;
}

.settings-section-title {
    font-size: 1.1rem;
    color: rgba(68, 255, 178, 0.9);
    margin-bottom: 15px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(68, 255, 178, 0.3);
    font-family: 'InfraRegular', monospace;
}

.settings-group {
    margin-bottom: 15px;
}

.settings-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.95rem;
    color: #fff;
    font-weight: 500;
}

.settings-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.settings-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px 12px;
    color: #fff;
    font-size: 0.9rem;
    font-family: 'InfraRegular', monospace;
    width: 120px;
    transition: all 0.3s ease;
}

.settings-input:focus {
    outline: none;
    border-color: rgba(68, 255, 178, 0.6);
    box-shadow: 0 0 0 2px rgba(68, 255, 178, 0.2);
    background: rgba(255, 255, 255, 0.15);
}

.settings-input.valid {
    border-color: rgba(68, 255, 178, 0.8);
    background: rgba(68, 255, 178, 0.1);
}

.settings-input.invalid {
    border-color: rgba(255, 68, 68, 0.8);
    background: rgba(255, 68, 68, 0.1);
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.settings-unit {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    min-width: 25px;
}

.settings-radio-group,
.settings-checkbox-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 4px;
}

.settings-radio-label,
.settings-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.settings-radio-label:hover,
.settings-checkbox-label:hover {
    background: rgba(255, 255, 255, 0.05);
}

.settings-radio,
.settings-checkbox {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.settings-radio {
    border-radius: 50%;
}

.settings-checkbox {
    border-radius: 4px;
}

.settings-radio:checked {
    border-color: rgba(68, 255, 178, 0.8);
    background: rgba(68, 255, 178, 0.2);
}

.settings-radio:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(68, 255, 178, 1);
}

.settings-checkbox:checked {
    border-color: rgba(68, 255, 178, 0.8);
    background: rgba(68, 255, 178, 0.2);
}

.settings-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(68, 255, 178, 1);
    font-size: 12px;
    font-weight: bold;
}

.settings-radio-text,
.settings-checkbox-text {
    color: #fff;
    font-size: 0.9rem;
    flex: 1;
}

.settings-help {
    display: block;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.3;
    margin-top: 3px;
    transition: color 0.3s ease;
}

.settings-help.error {
    color: rgba(255, 68, 68, 0.9);
    font-weight: 500;
}

.settings-modal-footer {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.settings-save-btn,
.settings-reset-btn {
    padding: 12px 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.9rem;
    font-family: 'InfraRegular', monospace;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.settings-save-btn:hover {
    background: rgba(68, 255, 178, 0.2);
    border-color: rgba(68, 255, 178, 0.5);
    transform: translateY(-1px);
}

.settings-reset-btn:hover {
    background: rgba(255, 68, 68, 0.2);
    border-color: rgba(255, 68, 68, 0.5);
    transform: translateY(-1px);
}

.settings-save-btn:active,
.settings-reset-btn:active {
    transform: translateY(0);
}

.settings-alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-family: 'InfraRegular', monospace;
    transition: opacity 0.3s ease;
}

.settings-alert-success {
    background: rgba(68, 255, 178, 0.2);
    border: 1px solid rgba(68, 255, 178, 0.4);
    color: rgba(68, 255, 178, 1);
}

.settings-alert-error {
    background: rgba(255, 68, 68, 0.2);
    border: 1px solid rgba(255, 68, 68, 0.4);
    color: rgba(255, 68, 68, 1);
}

.settings-alert-info {
    background: rgba(68, 178, 255, 0.2);
    border: 1px solid rgba(68, 178, 255, 0.4);
    color: rgba(68, 178, 255, 1);
}


@media (max-width: 768px) {
    .settings-modal-content {
        width: 95%;
        max-height: 75vh;
        padding: 15px;
    }
    
    .settings-modal-header h2 {
        font-size: 1.2rem;
    }
    
    .settings-section-title {
        font-size: 1rem;
    }
    
    .settings-input {
        width: 100px;
        padding: 8px 10px;
    }
    
    .settings-modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .settings-save-btn,
    .settings-reset-btn {
        width: 100%;
        min-width: auto;
    }

    .settings-radio-label,
    .settings-checkbox-label {
        padding: 6px 10px;
    }
}


@media (max-width: 480px) {
    .settings-input-group {
        flex-direction: row;
        align-items: center;
        align-content: center;
        gap: 5px;
    }
    
    .settings-unit {
        align-self: flex-start;
        margin-left: 12px;
        margin-top: -5px;
    }
}
