/* ============================================
   COMPONENTES
   ============================================ */

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 3px solid var(--primary-green);
    padding-left: 8px;
    color: var(--text-dark);
}

.results-card {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.1) 0%, rgba(46, 204, 113, 0.05) 100%);
    border-left: 3px solid var(--primary-green);
}

/* Botões */
.btn, button:not(.modal-close):not(.toggle-sidebar):not(.terminal-btn):not(.chat-close):not(.theme-selector-close) {
    padding: 6px 12px;
    border-radius: var(--border-radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 12px;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-green), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-small {
    padding: 3px 8px;
    font-size: 10px;
    background: var(--primary-green);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
}

.btn-small:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: linear-gradient(135deg, var(--primary-green), var(--primary-dark));
    color: white;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

.btn-remove {
    background: none;
    border: none;
    color: var(--primary-red);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: rgba(231, 76, 60, 0.1);
    transform: scale(1.1);
}

/* Itens Selecionados */
.selected-item {
    background: var(--bg-light);
    border-radius: var(--border-radius-md);
    padding: 8px;
    margin: 6px 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
    font-size: 12px;
}

.selected-item.empty {
    color: var(--text-muted);
}

.selected-item:hover {
    border-color: var(--primary-green);
    background: rgba(46, 204, 113, 0.1);
}

/* Listas */
.list-item {
    background: var(--bg-card);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: var(--transition);
    font-size: 12px;
}

.list-item:hover {
    background: var(--bg-light);
}

.item-info {
    flex: 1;
}

.item-title {
    font-weight: 600;
    font-size: 12px;
}

.item-subtitle {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.item-value {
    font-size: 11px;
    font-weight: 500;
    color: var(--primary-green);
    margin: 0 8px;
}

.item-actions {
    display: flex;
    gap: 6px;
}

/* Resultados */
.resultado-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 11px;
}

.resultado-item strong {
    color: var(--primary-green);
    font-size: 12px;
}

.detalhe-linha {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 11px;
}

.detalhe-label {
    color: var(--text-muted);
}

.detalhe-valor {
    font-weight: 500;
}

/* Quantidade Group */
.quantidade-group {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.quantidade-group .floating-group {
    margin-bottom: 0;
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    margin-top: 4px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 11px;
    color: var(--text-dark);
}

.checkbox-group input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
}

.toast {
    background: var(--bg-card);
    border-left: 4px solid var(--primary-green);
    padding: 8px 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease;
    font-size: 12px;
}

.toast.success {
    border-left-color: #2ecc71;
}

.toast.error {
    border-left-color: #e74c3c;
}

.toast.warning {
    border-left-color: #f39c12;
}

.toast span:first-child {
    font-size: 14px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loader */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    display: none;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-light);
    border-top-color: var(--primary-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.page-loader p {
    margin-top: 16px;
    color: white;
    font-size: 14px;
}

.error-page {
    text-align: center;
    padding: 50px;
}

.error-page i {
    font-size: 64px;
    color: var(--primary-red);
    margin-bottom: 20px;
}

.error-page h3 {
    margin-bottom: 10px;
}

.error-page p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ============================================
   IMAGENS NOS ITENS DA LISTA
   ============================================ */

/* Estilo para os itens da lista com imagem */
.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 8px 12px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 12px;
}

.list-item:hover {
    background: var(--bg-light);
}

.item-imagem {
    flex-shrink: 0;
}

.item-imagem img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: var(--bg-light);
    padding: 4px;
}

/* Upload de imagem */
.image-upload {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.image-upload .btn-small {
    display: flex;
    align-items: center;
    gap: 6px;
}

.image-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-light);
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.image-preview img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: white;
}

.image-preview .btn-icon {
    font-size: 14px;
    padding: 2px 6px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 4px;
}

.image-preview .btn-icon:hover {
    background: rgba(231, 76, 60, 0.3);
}

/* Ajuste para o floating group com upload */
.floating-group.image-upload {
    position: relative;
}

.floating-group.image-upload label {
    position: relative;
    left: 0;
    top: 0;
    transform: none;
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    color: var(--text-muted);
    background: transparent;
    padding: 0;
}

.floating-group.image-upload input,
.floating-group.image-upload select {
    margin-top: 4px;
}

.floating-group.image-upload small {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Full width para campos que ocupam toda linha */
.floating-group.full-width {
    grid-column: span 3;
}

@media (max-width: 768px) {
    .floating-group.full-width {
        grid-column: span 1;
    }
}

/* Nome do arquivo no preview */
.nome-arquivo {
    display: block;
    font-size: 10px;
    color: #2ecc71;
    margin-top: 4px;
    text-align: center;
    word-break: break-all;
}