/*
 * Pipali Styles - Input Components
 * Includes: input area, textarea, toolbar (model selector, status, attach, send/stop)
 */

/* Input Area */
.input-area {
    flex-shrink: 0;
    padding: 16px 24px 24px;
    background: var(--color-bg-elevated);
}

.input-container {
    max-width: 800px;
    margin: 0 auto;
}

.input-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 16px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input-form:focus-within {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(23, 23, 23, 0.06);
}

.input-form textarea {
    width: 100%;
    border: none;
    background: transparent;
    resize: none;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    color: var(--color-text);
    outline: none;
    min-height: 24px;
    max-height: 200px;
}

.input-form textarea::placeholder {
    color: var(--color-text-muted);
}

.input-form textarea::selection {
    background: var(--color-selection-bg);
    color: var(--color-selection-text);
}

.input-form textarea:disabled {
    opacity: 0.6;
}

/* Divider between textarea and toolbar */
.input-divider {
    height: 1px;
    background: var(--color-border-subtle);
    margin: 0 -16px;
}

/* Toolbar row below textarea */
.input-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.input-toolbar-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.input-toolbar-right {
    display: flex;
    align-items: center;
    gap: 2px;
}

.toolbar-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: var(--radius-md);
    padding: 0;
    transition: color var(--transition), background var(--transition);
}

.toolbar-button:hover {
    color: var(--color-text);
    background: var(--bg-hover);
}

.hidden-file-input {
    display: none;
}

/* Connection status dot */
.input-toolbar .status-dot {
    transition: color var(--transition);
}

.input-toolbar .status-dot.connected {
    color: var(--color-success);
}

.input-toolbar .status-dot.disconnected {
    color: var(--color-error);
}

/* Model selector (in toolbar) */
.input-toolbar .model-selector {
    position: relative;
}

.input-toolbar .model-selector-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: none;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: color var(--transition), background var(--transition);
}

.input-toolbar .model-selector-btn:hover {
    color: var(--color-text);
    background: var(--bg-hover);
}

.input-toolbar .model-selector-btn svg {
    transition: transform var(--transition);
}

.input-toolbar .model-selector-btn svg.rotated {
    transform: rotate(180deg);
}

.input-toolbar .model-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.input-toolbar .model-dropdown {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    min-width: 360px;
    max-height: 440px;
    overflow-y: auto;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: var(--z-dropdown);
    padding: 4px 0;
}

.input-toolbar .model-tier-group + .model-tier-group {
    margin-top: 4px;
    border-top: 1px solid var(--color-border);
    padding-top: 4px;
}

.input-toolbar .model-tier-header {
    padding: 6px 12px 2px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.input-toolbar .model-option {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    transition: background var(--transition);
    text-align: left;
}

.input-toolbar .model-option:hover {
    background: var(--color-bg-muted);
}

.input-toolbar .model-option.selected {
    background: var(--bg-active);
    box-shadow: inset 3px 0 0 var(--color-brand);
}

.input-toolbar .model-option.selected .model-option-name {
    font-weight: 600;
}

.input-toolbar .model-option-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.input-toolbar .model-option-row-secondary {
    font-size: 12px;
    color: var(--color-text-muted);
}

.input-toolbar .model-option-name {
    font-weight: 500;
}

.input-toolbar .model-recommended-pill {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.input-toolbar .model-tagline {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    line-height: 1.35;
    word-break: break-word;
}

.input-toolbar .model-cost-tier {
    margin-left: auto;
    font-family: var(--font-mono, monospace);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.input-toolbar .model-dropdown-empty {
    padding: 16px 12px;
    font-size: 13px;
    color: var(--color-text-muted);
    text-align: center;
}

.action-button {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
}

.action-button.send {
    background: var(--color-accent);
    color: var(--color-bg);
}

.action-button.send:hover:not(:disabled) {
    background: var(--color-accent-hover);
    transform: translateY(-1px);
}

.action-button.send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-button.stop {
    background: var(--color-warning);
    color: white;
}

.action-button.stop:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Drop Zone Overlay */
.drop-zone-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: color-mix(in srgb, var(--color-bg-elevated) 92%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.drop-zone-inner {
    border: 2px dashed var(--color-accent);
    border-radius: var(--radius-xl);
    padding: 48px 64px;
    text-align: center;
    color: var(--color-text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.drop-zone-inner p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.drop-zone-inner svg {
    color: var(--color-accent);
}

/* Staged File Chips */
.staged-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.staged-file-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: var(--color-bg-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    max-width: 220px;
}

.staged-file-chip .file-thumbnail {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.staged-file-chip .file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.staged-file-chip .file-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.staged-file-chip .file-name {
    font-size: 13px;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.staged-file-chip .file-size {
    font-size: 11px;
    color: var(--color-text-muted);
}

.staged-file-chip .remove-file {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    background: none;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 50%;
    flex-shrink: 0;
    padding: 0;
    transition: color var(--transition), background var(--transition);
}

.staged-file-chip .remove-file:hover {
    background: var(--color-border);
    color: var(--color-text);
}
