/* --- CORE: Main Input Wrapper --- */
.input-wrapper {
    display: flex;
    flex-direction: column; /* Stacks pills and input vertically */
    align-items: center;
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    padding: 10px; /* Consistent padding */
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    min-height: 60px;
    width: 100%;
    max-width: 580px;
}

.input-wrapper:focus-within {
    border-color: var(--accent-medical);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

/* ADDED: This new class keeps the text input and action buttons in a row */
.input-field-row {
    display: flex;
    align-items: center;
    width: 100%;
}

.input-field-row .consultation-input {
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 10px 0 10px 10px; /* Adjusted padding */
    flex-grow: 1;
    outline: none;
    font-size: 16px;
    color: var(--text-primary);
    min-width: 0; /* Prevents flexbox overflow */
}

.input-field-row .input-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 10px;
    position: relative; 
    padding-right: 50px; /* Space for the absolute positioned button */
}

/* --- UNIFIED PILL CONTAINER STYLE --- */
#file-pill-container,
#file-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    padding-bottom: 8px; /* Space below pills */
    border-bottom: 1px solid var(--border-soft); /* Separator line */
    margin-bottom: 8px; /* Space between separator and input */
}
/* Hide the container, its padding, and border completely when it's empty */
#file-pill-container:empty,
#file-preview-container:empty {
    display: none !important;
}

/* --- UNIFIED PILL STYLE --- */
.file-preview-pill {
    display: inline-flex;
    align-items: center;
    background-color: #eef2f7;
    border-radius: 16px;
    padding: 4px 6px 4px 10px;
    font-size: 13px;
    color: #475569;
    max-width: 200px;
    gap: 6px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    animation: fadeIn 0.3s ease;
}
.file-preview-pill:hover {
    border-color: #d1d5db;
}

.file-preview-pill i {
    color: var(--accent-medical);
    font-size: 14px;
    flex-shrink: 0;
}

.file-preview-pill span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
    min-width: 0;
}

.file-pill-remove {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 16px;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.file-pill-remove:hover {
    color: #ef4444;
}

/* --- UNIVERSAL: Buttons --- */
.file-upload-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    color: var(--text-light);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 16px;
}

.file-upload-btn:hover {
    background: rgba(79, 195, 247, 0.1);
    color: var(--accent-medical);
}

.input-submit-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: rgba(19, 50, 74, 0.65);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-warm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    backdrop-filter: blur(10px);
}

.input-submit-btn:hover {
    transform: translateY(-50%) scale(1.1);
    background: rgba(79, 195, 247, 0.7);
    box-shadow: var(--magnetic-shadow);
}

/* --- ATTACHMENT TAB IN CHAT --- */
.attachments-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.attachment-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    font-size: 12px;
    color: #4b5563;
    background-color: #f9fafb;
    transition: box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-decoration: none;
}

.attachment-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.attachment-item img {
    width: 100%;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
}

.file-icon-wrapper {
    font-size: 36px;
    color: #9ca3af;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.attachment-name {
    word-break: break-all;
    font-weight: 500;
}

/* --- UNIVERSAL: Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* --- RESPONSIVE: Mobile View --- */
@media (max-width: 768px) {
    .input-wrapper {
        width: 97%;
        max-width: none;
    }
}