/* css/input.css */
/* ===== INPUT AREA (FIXED BOTTOM) ===== */
.input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    min-height: 80px;
    background: var(--bg-main);
    border-top: 1px solid var(--border);
    z-index: 10050 !important;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 10px 12px;
    pointer-events: none !important;
}

.input-wrapper {
    width: 100%;
    max-width: 800px;
    position: relative;
    pointer-events: none !important;
}

/* ===== MAIN INPUT CONTAINER — flex column so chips sit ABOVE textarea ===== */
.input-container {
    position: relative;
    z-index: 10051 !important;
    display: flex;
    flex-direction: column;   /* ← KEY: stack chips then row */
    gap: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 8px 8px 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
    pointer-events: auto !important;
    min-height: 52px;
}

.input-container:focus-within {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 2px 12px rgba(26, 115, 232, 0.15);
}

/* ===== FILE CHIPS ROW — hidden until files are added ===== */
.file-chips-row {
    display: none;           /* shown via JS when files exist */
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 6px 8px;
    max-height: 140px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.file-chips-row.has-files {
    display: flex;
}

/* ===== SINGLE FILE CHIP ===== */
.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 5px;
    background: var(--bg-main, #f1f3f4);
    border: 1px solid var(--border, #dadce0);
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-primary, #202124);
    max-width: 200px;
    transition: background 0.15s;
    cursor: default;
    flex-shrink: 0;
}

.file-chip:hover {
    background: #e8eaed;
}

/* Image thumbnail inside chip */
.file-chip-thumb {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

/* Icon for non-image files */
.file-chip-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: white;
    flex-shrink: 0;
}

.file-chip-icon.pdf        { background: #e53935; }
.file-chip-icon.image      { background: #43a047; }
.file-chip-icon.document   { background: #1e88e5; }
.file-chip-icon.spreadsheet{ background: #fb8c00; }
.file-chip-icon.presentation{ background: #8e24aa; }
.file-chip-icon.text       { background: #607d8b; }
.file-chip-icon.audio      { background: #00897b; }
.file-chip-icon.video      { background: #e91e63; }
.file-chip-icon.archive    { background: #795548; }
.file-chip-icon.default    { background: var(--primary, #1a73e8); }

/* Text block inside chip */
.file-chip-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 120px;
}

.file-chip-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.file-chip-size {
    font-size: 10px;
    color: var(--text-secondary, #5f6368);
    line-height: 1.2;
}

/* Remove (×) button on chip */
.file-chip-remove {
    width: 16px;
    height: 16px;
    min-width: 16px;
    border: none;
    background: rgba(0, 0, 0, 0.15);
    color: var(--text-primary, #202124);
    border-radius: 50%;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
    transition: background 0.15s;
}

.file-chip-remove:hover {
    background: rgba(0, 0, 0, 0.28);
}

/* ===== INPUT ROW — textarea + buttons in one horizontal line ===== */
.input-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== BUTTONS ===== */
.input-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px;
    min-height: 40px;
    border: none;
    background: none;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
    color: var(--text-secondary);
    font-size: 20px !important;
    flex-shrink: 0;
    position: relative;
    z-index: 10055 !important;
    pointer-events: all !important;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    margin: 0 !important;
    padding: 0 !important;
    transition: background 0.15s, transform 0.1s;
}

.input-btn:hover {
    background: var(--hover, rgba(0,0,0,0.06)) !important;
    transform: scale(1.1);
}

.input-btn:active {
    transform: scale(0.9) !important;
    background: var(--primary, #1a73e8) !important;
    color: white !important;
}

.input-btn i {
    pointer-events: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: inherit !important;
}

/* ===== TEXTAREA ===== */
.main-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    padding: 6px 8px;
    resize: none;
    max-height: 120px;
    min-height: 28px;
    font-family: inherit;
    color: var(--text-primary);
    line-height: 1.5;
    pointer-events: auto !important;
    z-index: 1;
}

.main-input::placeholder {
    color: var(--text-secondary);
}

/* ===== ACTION BUTTONS CLUSTER ===== */
.input-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
    pointer-events: auto !important;
    z-index: 10054 !important;
}

/* ===== SEND BUTTON ===== */
.send-btn {
    background: var(--primary, #1a73e8) !important;
    color: white !important;
}

.send-btn:hover {
    opacity: 0.9;
    background: var(--primary, #1a73e8) !important;
    transform: scale(1.05) !important;
}

.send-btn:active {
    background: var(--primary, #1a73e8) !important;
    color: white !important;
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== HINT TEXT ===== */
.input-hint {
    text-align: center;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-secondary);
    pointer-events: none !important;
}

/* ===== DRAG-OVER HIGHLIGHT ===== */
.input-container.drag-over {
    border-color: var(--primary, #1a73e8) !important;
    background: rgba(26, 115, 232, 0.06) !important;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2) !important;
}

/* ===== HIDE OLD EXTERNAL ATTACHMENTS CONTAINER ===== */
.file-attachments-container {
    display: none !important;
}
