/* Aetheria 2.0 System Framework: Universal Interface Widgets & Assets */

/* -- FORM INPUT ELEMENTS -- */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 8px; font-weight: 500; }
.form-group input {
    width: 100%; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-glass);
    border-radius: 12px; padding: 12px 16px; color: var(--text-primary); font-size: 0.95rem; outline: none;
}
.form-group small { display: block; margin-top: 6px; font-size: 0.75rem; color: var(--text-secondary); }

/* 🔢 PREMIUM NUMBER INPUTS (Firefox & Webkit Fix) */
input[type=number] {
    appearance: auto !important;
    -moz-appearance: number-input !important; /* CRITICAL FOR FIREFOX */
}
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    opacity: 0.8;
    filter: invert(1);
    cursor: pointer;
}

.btn-save {
    width: 100%; background: var(--accent); color: #fff; border: none;
    border-radius: 12px; padding: 14px; font-weight: 600; cursor: pointer; transition: all 0.3s ease;
}
.btn-save:hover { box-shadow: 0 0 20px var(--accent-glow); transform: translateY(-2px); }

.select-glass {
    width: 100%; background-color: #131524 !important; border: 1px solid var(--border-glass);
    border-radius: 12px; padding: 12px 16px; color: #ffffff !important; font-size: 0.95rem;
    outline: none; cursor: pointer; appearance: none !important; -webkit-appearance: none !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23a0a5c0'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpolyline%20points='6%209%2012%2015%2018%209'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important; background-position: right 16px center !important; background-size: 16px !important;
}
.select-glass:hover { border-color: var(--accent); background-color: #1a1d30 !important; }
.select-glass option { background-color: #131524 !important; color: #ffffff !important; }

.form-row { display: flex; gap: 16px; }
.form-group.half { flex: 1; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* -- SMART DIRECTIONAL TAB RIBBON -- */
.tabs-scroll-wrapper { position: relative; width: 100%; margin-bottom: 24px; }
.tab-scroll-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(108, 92, 231, 0.8); border: 1px solid rgba(255,255,255,0.2); color: white;
    width: 28px; height: 28px; border-radius: 50%; display: none; align-items: center;
    justify-content: center; cursor: pointer; z-index: 10; font-size: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); backdrop-filter: blur(5px); transition: all 0.2s ease;
}
.tab-scroll-nav:hover { background: var(--accent); transform: translateY(-50%) scale(1.15); }
.nav-left { left: -5px; }
.nav-right { right: -5px; }

.tab-buttons {
    display: flex; border-bottom: 1px solid var(--border-glass); gap: 8px;
    overflow-x: auto; white-space: nowrap; scrollbar-width: none;
}
.tab-buttons::-webkit-scrollbar { display: none; }
.tab-btn {
    background: transparent; border: none; color: var(--text-secondary);
    padding: 12px 20px; font-size: 0.95rem; font-weight: 600; cursor: pointer;
    border-bottom: 2px solid transparent; transition: all 0.3s ease;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* -- TOGGLE SWITCHES -- */
.switch-label { display: inline-flex !important; align-items: center; gap: 12px; cursor: pointer; font-size: 0.9rem; font-weight: 500; color: var(--text-primary); }
.switch-input { display: none; }
.switch-custom { position: relative; width: 44px; height: 24px; background: rgba(255, 255, 255, 0.1); border-radius: 20px; transition: all 0.3s ease; border: 1px solid var(--border-glass); }
.switch-custom::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: var(--text-secondary); top: 3px; left: 4px; transition: all 0.3s ease; }
.switch-input:checked + .switch-custom { background: var(--accent); border-color: var(--accent); }
.switch-input:checked + .switch-custom::after { left: 22px; background: #fff; }

/* -- WHISPER MODEL UTILS -- */
.model-manager-box { margin-top: 24px; background: rgba(255, 255, 255, 0.02); border: 1px solid var(--border-glass); border-radius: 16px; padding: 16px; }
.manager-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 12px; }
.model-list { display: flex; flex-direction: column; gap: 12px; }
.model-item { display: flex; justify-content: space-between; align-items: center; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-glass); border-radius: 12px; padding: 12px 16px; }
.model-info-left { display: flex; flex-direction: column; gap: 4px; }
.model-status-box { display: flex; align-items: center; gap: 12px; }
.progress-bar-container { width: 100px; height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--accent); transition: width 0.3s ease; }
.btn-dl, .btn-del { border: none; border-radius: 8px; padding: 6px 12px; font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease; }
.btn-dl { background: var(--accent); color: #fff; }
.btn-del { background: rgba(214, 48, 49, 0.15); color: #d63031; border: 1px solid rgba(214, 48, 49, 0.25); }
.model-item-downloaded { border-color: rgba(0, 184, 148, 0.25); background: rgba(0, 184, 148, 0.02); }

/* -- BUBBLE UTILS -- */
.audio-btn {
    background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 6px;
    color: var(--text-primary); font-size: 0.75rem; font-weight: 500; cursor: pointer; padding: 4px 10px;
    display: flex; align-items: center; gap: 6px; transition: all 0.2s ease;
}
.audio-btn:hover { background: rgba(255, 255, 255, 0.12); border-color: var(--accent); }

.icon-only-btn {
    background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-glass); color: var(--text-primary);
    width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; cursor: pointer; transition: all 0.2s ease; padding: 0; line-height: 1;
}
.icon-only-btn:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.2);    transform: scale(0.98);
}

/* 🛡️ TOOL CONFIRMATION CARD */
.system-confirm-bubble {
    background: transparent !important;
    padding: 0 !important;
    margin: 20px auto !important;
    max-width: 90% !important;
}

.confirm-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: slideInUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.confirm-header {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--accent);
    font-weight: bold;
    font-size: 1.1rem;
}

.confirm-text {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 12px;
}

.btn-confirm-yes, .btn-confirm-no {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-confirm-yes {
    background: rgba(0, 184, 148, 0.15);
    color: #00b894;
}

.btn-confirm-no {
    background: rgba(214, 48, 49, 0.15);
    color: #ff7675;
}

.btn-confirm-yes:hover { background: #00b894; color: white; }
.btn-confirm-no:hover { background: #d63031; color: white; }

.btn-confirm-yes:disabled, .btn-confirm-no:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

@keyframes slideInUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Absolute select overlays */
.header-icon-btn-wrapper { position: relative; width: 40px; height: 40px; }
.invisible-select-overlay {
    position: absolute !important; top: 0; left: 0; width: 100% !important; height: 100% !important;
    opacity: 0; cursor: pointer; z-index: 5; padding: 0 !important; margin: 0 !important;
}
/* -- PREMIUM AGENT THOUGHT UI (Modern Collapsible Reasoning) -- */
.agent-thought-details {
    margin: 12px 0;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}
.agent-thought-details:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}
.agent-thought-details summary {
    list-style: none; /* Hide standard arrow */
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.3px;
    user-select: none;
}
/* Custom CSS Chevron marker */
.agent-thought-details summary::before {
    content: '';
    width: 6px;
    height: 6px;
    border-top: 2px solid rgba(255,255,255,0.5);
    border-right: 2px solid rgba(255,255,255,0.5);
    transform: rotate(45deg); /* Standard point right */
    transition: transform 0.2s ease;
    margin-right: 4px;
}
/* Rotate chevron when open */
.agent-thought-details[open] summary::before {
    transform: rotate(135deg); /* Point down */
}
/* Webkit specific hide */
.agent-thought-details summary::-webkit-details-marker {
    display: none;
}
.agent-thought-content {
    padding: 12px 16px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    font-family: 'Inter', sans-serif;
    animation: fadeInSlide 0.25s ease-out forwards;
    word-break: break-word;
}
.agent-thought-content pre {
    max-width: 100%;
    overflow-x: auto !important;
    white-space: pre-wrap;
    word-break: break-all;
}
@keyframes fadeInSlide {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}
