/* Settings Modal Styles */

/* Modal Overlay */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-out;
}

.settings-modal.show {
    opacity: 1;
    visibility: visible;
}

/* Modal Content */
.settings-modal-content {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.settings-modal.show .settings-modal-content {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.settings-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #21262d;
    background: #060607;
    border-radius: 12px 12px 0 0;
}

.settings-modal-header h3 {
    margin: 0;
    color: #f0f6fc;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #8b949e;
    font-size: 18px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.settings-modal-close:hover {
    background: #21262d;
    color: #f0f6fc;
}

.settings-modal-close:active {
    background: #30363d;
}

/* Modal Body */
.settings-modal-body {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #000000;
    min-height: 0;
}

.welcome-message {
    background: var(--accent-primary-05);
    border: 1px solid var(--accent-primary-20);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px;
    margin-bottom: 20px;
}

.welcome-message p {
    margin: 0 0 6px 0;
    color: #f0f6fc;
    font-size: 0.9rem;
    line-height: 1.4;
}

.welcome-message p:last-child {
    margin-bottom: 0;
}

.security-note {
    font-size: 0.85rem;
    color: #debc13 !important;
    font-weight: 500;
}

/* Settings Sections */
.settings-section {
    margin: 16px;
    margin-bottom: 20px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    color: #f0f6fc;
    font-weight: 500;
    font-size: 0.85rem;
}

.help-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 400;
}

.help-link:hover {
    text-decoration: underline;
}

/* Input Containers */
.token-input-container,
.file-input-container {
    display: flex;
    gap: 6px;
    align-items: stretch;
}

.settings-input {
    flex: 1;
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 6px;
    padding: 6px 8px;
    color: #f0f6fc;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.settings-input::placeholder {
    color: #6e7681;
}

.settings-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-primary-10);
    background: #161b22;
}

.settings-input:invalid {
    border-color: var(--accent-error);
}

/* Token Visibility Toggle */
.toggle-visibility {
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 6px;
    padding: 6px 8px;
    color: #8b949e;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-visibility:hover {
    background: #21262d;
    color: #f0f6fc;
    border-color: #30363d;
}

/* Add File Button */
.add-file-btn {
    background: var(--accent-button-dark);
    border: 1px solid var(--accent-button-dark-border);
    border-radius: 6px;
    padding: 6px 12px;
    color: #ffffff;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.2s ease;
}

.add-file-btn:hover {
     background: var(--accent-button-dark-hover);
}

.add-file-btn:disabled {
    background: #484f58;
    border-color: #484f58;
    color: #6e7681;
    cursor: not-allowed;
}

/* Validation Messages */
.validation-message {
    margin-top: 4px;
    font-size: 0.8rem;
    min-height: 1em;
}

.validation-message.error {
    color: var(--accent-error);
}

.validation-message.success {
    color: var(--accent-success-bright);
}

/* Files List */
.files-list,
.component-files-list {
    border: 1px solid #21262d;
    border-radius: 6px;
    background: #0d1117;
    overflow: hidden;
}

.empty-files {
    padding: 16px;
    text-align: center;
    color: #6e7681;
    font-style: italic;
    font-size: 0.85rem;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #21262d;
    transition: all 0.2s ease;
}

.component-file-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #21262d;
    transition: all 0.2s ease;
}

.file-item:last-child,
.component-file-item:last-child {
    border-bottom: none;
}

.file-item:hover,
.component-file-item:hover {
    background: var(--accent-primary-05);
}

.file-item.active {
    background: var(--accent-primary-08);
    border-left: 2px solid var(--accent-primary);
}

.file-radio-label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin: 0;
}

.file-radio {
    margin: 0;
    cursor: pointer;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: #f0f6fc;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.file-status {
    font-size: 0.7rem;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 500;
    text-transform: uppercase;
}

.file-status.current {
    background: rgba(56, 211, 100, 0.2);
    color: #38d364;
}

.file-status.recent {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.file-status.outdated {
    background: rgba(255, 152, 0, 0.2);
    color: #ff9800;
}

.file-status.stale {
    background: rgba(248, 81, 73, 0.2);
    color: #f85149;
}

.file-status.unknown {
    background: rgba(139, 148, 158, 0.2);
    color: #8b949e;
}

.file-url {
    font-size: 0.8rem;
    color: #6e7681;
    font-family: 'Space Grotesk', monospace;
    word-break: break-all;
}

.file-meta {
    font-size: 0.75rem;
    color: #8b949e;
    margin-top: 2px;
}

.remove-file-btn {
    background: #21262d;
    border: 1px solid #30363d;
    color: #6e7681;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.remove-file-btn:hover {
    background: var(--accent-error-alt);
    border-color: var(--accent-error-alt);
    color: #ffffff;
}

.remove-file-btn:active {
    background: #c93430;
    transform: scale(0.95);
}

.help-text {
    color: #8b949e;
    font-size: 0.75rem;
    font-weight: 400;
    display: block;
    margin-top: 2px;
}

/* Modal Footer */
.settings-modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 12px 16px;
    border-top: 1px solid #21262d;
    background: #060607;
    border-radius: 0 0 12px 12px;
}

.settings-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.85rem;
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid;
}

.settings-btn-primary {
    background: var(--accent-button-dark);
    border-color: var(--accent-button-dark-border);
    color: #ffffff;
}

.settings-btn-primary:hover {
    background: var(--accent-button-dark-hover);
}

.settings-btn-primary:disabled {
    background: #484f58;
    border-color: #484f58;
    color: #6e7681;
    cursor: not-allowed;
}

.settings-btn-secondary {
    background: #21262d;
    border-color: #30363d;
    color: #f0f6fc;
}

.settings-btn-secondary:hover {
    background: #30363d;
}

/* Settings Button in Version Control Bar */
.settings-btn-icon {
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.settings-btn-icon:hover {
    background: #21262d;
    color: #f0f6fc;
}

.settings-btn-icon:active {
    transform: translateY(1px);
}

.settings-btn-icon.needs-setup {
    color: var(--accent-error);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Success Notifications */
.settings-notification {
    position: fixed;
    bottom: 200px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 12px 16px;
    color: #f0f6fc;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10001;
    transition: transform 0.3s ease;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

.settings-notification.show {
    transform: translateX(-50%) translateY(0);
}

.settings-notification.success {
    border-color: #2ea043;
    background: rgba(46, 160, 67, 0.1);
}

.settings-notification.info {
    border-color: var(--accent-primary);
    background: var(--accent-primary-10);
}

.reload-btn {
    background: var(--accent-primary);
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    margin-left: 8px;
    transition: background 0.2s ease;
}

.reload-btn:hover {
    background: var(--accent-primary-hover);
}

/* Responsive Design */
@media (max-width: 768px) {
    .settings-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .settings-modal-header {
        padding: 12px 16px;
    }
    
    .settings-modal-body {
        padding: 4px;
    }
    
    .settings-section {
        margin: 12px;
    }
    
    .files-list {
       font-family: 'Space Grotesk', monospace;
    }
    
    .welcome-message {
        margin: 12px;
    }
    
    .settings-modal-footer {
        padding: 8px 12px;
        flex-direction: column-reverse;
    }
    
    .token-input-container,
    .file-input-container {
        flex-direction: center;
        gap: 6px;
    }
    
    .settings-btn {
        width: 100%;
        justify-content: center;
    }
    
    .file-item {
        align-items: flex-start;
        gap: 8px;
    }
    
    .file-radio-label {
        width: 100%;
    }
    
    .remove-file-btn {
        align-self: center;
    }
}

/* Scrollbar for settings modal */
.settings-modal-content {
    scrollbar-width: thin;
    scrollbar-color: #484f58 #21262d;
}

.settings-modal-content::-webkit-scrollbar {
    width: 8px;
}

.settings-modal-content::-webkit-scrollbar-track {
    background: #21262d;
    border-radius: 4px;
}

.settings-modal-content::-webkit-scrollbar-thumb {
    background: #484f58;
    border-radius: 4px;
}

.settings-modal-content::-webkit-scrollbar-thumb:hover {
    background: #6e7681;
}
