/* Components - Buttons, inputs, forms */

/* Expertise Buttons */
.expertise-label {
    font-size: 0.75rem;
    color: #718096;
}

.expertise-buttons {
    display: flex;
    gap: 4px;
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
}

.expertise-btn {
    padding: 6px 12px;
    border: 2px solid #cbd5e0;
    background: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: #4a5568;
}

.expertise-btn:hover {
    border-color: #667eea;
    background: #f7fafc;
}

.expertise-btn.active {
    background: #da7756;
    border-color: #da7756;
    color: white;
    box-shadow: 0 4px 12px rgba(218, 119, 86, 0.25);
}

/* Selector Group */
.selector-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.config-row label {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    display: block;
}

.config-row select {
    width: 100%;
    padding: 4px 6px;
    font-size: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.selector-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #4a5568;
}

.selector-group select {
    padding: 6px 8px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.selector-group select:hover {
    border-color: #667eea;
}

.selector-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* Preset Tabs */
.preset-tab {
    padding: 3px 8px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.preset-tab:hover {
    background: #e2e8f0;
}

.preset-tab.active {
    background: #4a90a4;
    color: white;
}

.preset-tab:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.preset-tab.active {
    color: #667eea;
    background: rgba(102, 126, 234, 0.15);
    border-bottom: 2px solid #667eea;
    margin-bottom: -10px;
}

/* Preset Groups */
.preset-group {
    display: none;
}

.preset-group.active {
    display: block;
}

/* Preset Buttons */
/* Profile buttons - horizontal flow with wrapping */
.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

.preset-btn {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.7rem;
    white-space: nowrap;
}

.preset-btn:hover {
    border-color: #da7756;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.preset-btn.active {
    border-color: #da7756;
    background: linear-gradient(135deg, rgba(218, 119, 86, 0.15), rgba(74, 144, 164, 0.1));
    box-shadow: 0 1px 3px rgba(218, 119, 86, 0.2);
    border-color: #48bb78;
    background: linear-gradient(135deg, rgba(72, 187, 120, 0.1), rgba(56, 161, 105, 0.1));
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.2);
}

.preset-btn.preset-dangerous {
    border-color: #cbd5e0;
    background: white;
    pointer-events: auto;
    cursor: pointer;
}

.preset-btn.preset-dangerous:hover {
    background: rgba(100, 116, 139, 0.1);
    border-color: #475569;
    background: linear-gradient(135deg, rgba(100, 116, 139, 0.1), rgba(71, 85, 105, 0.1));
    pointer-events: auto;
}

.preset-btn.preset-dangerous.active {
    border-color: #475569;
    background: linear-gradient(135deg, rgba(100, 116, 139, 0.15), rgba(71, 85, 105, 0.15));
    box-shadow: 0 2px 8px rgba(100, 116, 139, 0.3);
}

.preset-icon {
    font-size: 1rem;
}

.preset-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: #2d3748;
}

/* Preset Warning Box */
.preset-warning {
    margin-top: 12px;
    padding: 12px 16px;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    color: #92400e;
    font-size: 0.9rem;
    line-height: 1.5;
}

.preset-warning.dangerous {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

/* Legacy level buttons */
.level-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.level-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.level-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.level-btn.active {
    background: linear-gradient(135deg, #48bb78, #38a169);
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
}

/* Tool Checkboxes */
.tool-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px;
    align-items: flex-start;
    overflow: hidden;
}

.tool-group label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
    background: white;
    border-radius: 3px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
    font-size: 0.7rem;
    white-space: nowrap;
    min-width: 0;
}

.tool-group label span {
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
}

.tool-group label:hover {
    background: #fff5f0;
    border-color: #da7756;
}

.tool-checkbox {
    margin-right: 0px;
    transform: scale(1.0);
    accent-color: #667eea;
    flex-shrink: 0;
}

/* Flag with options */
.flag-with-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.flag-options-panel {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0 4px 20px;
    border-left: 2px solid #e67e22;
    margin-left: 8px;
}

.flag-radio-option {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
}

.flag-radio-option:hover {
    background: #fff5f0;
}

.flag-radio-option input[type="radio"] {
    accent-color: #e67e22;
    margin: 0;
}

.flag-custom-input {
    font-size: 0.7rem;
    padding: 2px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    width: 100px;
}

.flag-custom-input:disabled {
    background: #f7fafc;
    color: #a0aec0;
}

.flag-custom-input:focus {
    outline: none;
    border-color: #e67e22;
}

/* Flag with text input */
.flag-with-input {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.flag-input-field {
    display: none;
    margin-left: 20px;
    padding: 4px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.75rem;
    width: calc(100% - 28px);
    box-sizing: border-box;
}

.flag-input-field:focus {
    outline: none;
    border-color: #667eea;
}

/* Code Display */
.code-container {
    position: relative;
    background: #1a202c;
    border-radius: 6px;
    padding: 12px;
    margin-top: 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
}

#command-output {
    color: #e2e8f0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.3;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    padding-right: 80px;
    max-height: 120px;
    overflow-y: auto;
    width: 100%;
}

/* Command line highlighting */
.cmd-line {
    display: block;
}

.cmd-highlighted {
    background: rgba(72, 187, 120, 0.3);
    color: #68d391;
    font-weight: 600;
    border-left: 3px solid #48bb78;
    padding-left: 8px;
    margin-left: -8px;
}

.cmd-dimmed {
    opacity: 0.4;
}

.copy-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 4px 8px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.copy-btn:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.copy-btn.copied {
    background: #48bb78;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e0;
    transition: 0.3s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #667eea;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a5568;
}

/* Command toggles container */
.command-toggles {
    display: flex;
    gap: 16px;
    align-items: center;
}

.command-toggles-vertical {
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.command-toggle-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Profile Controls - Compact layout */
.profile-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    overflow-x: visible;
}

#profile-name, #profile-flag {
    padding: 6px 8px;
    border: 1.5px solid #e2e8f0;
    border-radius: 5px;
    font-size: 0.8rem;
    width: 100px;
    flex-shrink: 0;
    background: white;
    transition: all 0.2s ease;
}

#profile-name:focus, #profile-flag:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#load-profile {
    padding: 6px 8px;
    border: 1.5px solid #e2e8f0;
    border-radius: 5px;
    background: white;
    font-size: 0.8rem;
    cursor: pointer;
    min-width: 90px;
    flex-shrink: 0;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #4a5568;
}

#load-profile:hover {
    border-color: #667eea;
    background: #f7fafc;
}

.profile-controls button {
    padding: 6px 10px;
    border: 1.5px solid transparent;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    flex-shrink: 0;
    white-space: nowrap;
    min-width: fit-content;
}

#save-profile, .btn-primary {
    background: #48bb78;
    color: white;
    border-color: #48bb78;
}

#save-profile:hover, .btn-primary:hover {
    background: #38a169;
    border-color: #38a169;
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.2);
    transform: translateY(-1px);
}

#delete-profile, .btn-danger {
    background: #f56565;
    color: white;
    border-color: #f56565;
}

#delete-profile:hover, .btn-danger:hover {
    background: #e53e3e;
    border-color: #e53e3e;
    box-shadow: 0 2px 8px rgba(245, 101, 101, 0.2);
    transform: translateY(-1px);
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.75rem;
    min-width: auto;
}

.btn-add, .preset-btn.btn-add {
    background: #667eea;
    color: white;
    border: 1px dashed #667eea;
    opacity: 0.7;
}

.btn-add:hover, .preset-btn.btn-add:hover {
    opacity: 1;
    background: #5a67d8;
}

#add-group {
    padding: 4px 8px;
    font-size: 0.8rem;
    background: transparent;
    border: 1px dashed #667eea;
    color: #667eea;
    border-radius: 4px;
    cursor: pointer;
}

#add-group:hover {
    background: #667eea;
    color: white;
}

#set-default {
    background: #805ad5;
    color: white;
    border-color: #805ad5;
}

#set-default:hover {
    background: #6b46c1;
    border-color: #6b46c1;
    box-shadow: 0 2px 8px rgba(128, 90, 213, 0.2);
    transform: translateY(-1px);
}

.default-indicator {
    display: inline-block;
    background: #48bb78;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    margin-left: 6px;
    font-weight: 600;
}

.profile-actions button {
    padding: 6px 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    background: white;
    color: #4a5568;
    min-width: fit-content;
}

.profile-actions button:hover {
    border-color: #667eea;
    color: #667eea;
    background: #f7fafc;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.profile-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.profile-actions button:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Loading states */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Inline action icons for selected profiles/groups */
.inline-actions {
    display: inline-flex;
    gap: 2px;
    margin-left: 4px;
    vertical-align: middle;
}

.inline-action-btn {
    background: none;
    border: none;
    padding: 0 2px;
    cursor: pointer;
    font-size: 0.7rem;
    opacity: 0.7;
    transition: opacity 0.15s ease, transform 0.15s ease;
    line-height: 1;
}

.inline-action-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

.inline-action-btn.edit-btn:hover {
    color: #667eea;
}

.inline-action-btn.delete-btn:hover {
    color: #ef4444;
}

.inline-action-btn.star-btn {
    color: #f59e0b;
}

.inline-action-btn.star-btn.is-default {
    opacity: 1;
}

/* Inline edit input */
.inline-edit-input {
    font-size: 0.7rem;
    padding: 2px 4px;
    border: 1px solid #667eea;
    border-radius: 3px;
    width: 80px;
    background: white;
}

.inline-edit-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

/* Inline edit wrapper for input + tooltip */
.inline-edit-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Space warning tooltip */
.space-warning-tooltip {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    padding: 4px 8px;
    background: #dc2626;
    color: white;
    font-size: 0.65rem;
    font-weight: 500;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.space-warning-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 10px;
    border: 4px solid transparent;
    border-bottom-color: #dc2626;
}

/* Permanent space warning icon on profile buttons */
.space-warning-icon {
    display: inline-block;
    margin-left: 2px;
    font-size: 0.65rem;
    cursor: help;
    filter: saturate(1.5);
}

/* Profile/Group button with actions */
.preset-btn.active .profile-name-text,
.preset-tab.active .group-name-text {
    display: inline;
}

.preset-btn .inline-actions,
.preset-tab .inline-actions {
    display: none;
}

.preset-btn.active .inline-actions,
.preset-tab.active .inline-actions {
    display: inline-flex;
}

/* Row label styling */
.row-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}

/* Profile groups section layout */
.profile-groups-section {
    background: white;
    padding: 6px 8px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    grid-column: span 2;
}

.profile-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.profile-groups-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.profiles-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.profiles-row .row-label {
    padding-top: 4px;
}

.command-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
}

.command-row .row-label {
    font-size: 0.75rem;
    color: #718096;
    min-width: 55px;
}

.command-name-input {
    width: 100px;
    padding: 4px 8px;
    font-size: 0.8rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: white;
}

.command-name-input:focus {
    outline: none;
    border-color: #667eea;
}

.syntax-preview-label {
    font-size: 0.75rem;
    color: #718096;
    margin-left: 8px;
}

.syntax-preview {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.syntax-preview code {
    background: #2d3748;
    color: #e2e8f0;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.syntax-or {
    color: #a0aec0;
    font-style: italic;
}

.profile-io-buttons {
    display: flex;
    gap: 4px;
}

.btn-inline-add {
    padding: 2px 6px;
    font-size: 0.7rem;
    background: transparent;
    border: 1px dashed #667eea;
    color: #667eea;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-inline-add:hover {
    background: #667eea;
    color: white;
}

.btn-io {
    padding: 2px 8px;
    font-size: 0.7rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    color: #64748b;
}

.btn-io:hover {
    border-color: #667eea;
    color: #667eea;
}
